Skip to main content

ArrowWriter

arrow-logo

From-v3.0

The ArrowWriter encodes a set of arrays into an ArrayBuffer of Apach Arrow columnar format.

LoaderCharacteristic
File FormatArrow
Data FormatArrow Columnar Format
File Extensions.arrow, .feather
File TypeBinary
Support APIencodeSync

Usage​

import {encodeSync} from '@loaders.gl/core';
import {ArrowWriter, VECTOR_TYPES} from '@loaders.gl/arrow';

const LENGTH = 2000;

const rainAmounts = Float32Array.from({length: LENGTH}, () =>
Number((Math.random() * 20).toFixed(1))
);

const rainDates = Array.from(
{length: LENGTH},
(_, i) => new Date(Date.now() - 1000 * 60 * 60 * 24 * i)
);

const arraysData = [
{array: rainAmounts, name: 'precipitation', type: VECTOR_TYPES.FLOAT},
{array: rainDates, name: 'date', type: VECTOR_TYPES.DATE}
];

const arrayBuffer = encodeSync(arraysData, ArrowWriter);

Options​

OptionTypeDefaultDescription

Dependencies​

Apache Arrow JS library is included into the bundle.