• Write Arrow data to a Parquet file.

    For example, to create a Parquet file with Snappy compression:

    import { tableToIPC } from "apache-arrow";
    // Edit the `parquet-wasm` import as necessary
    import initWasm, {
    Table,
    WriterPropertiesBuilder,
    Compression,
    writeParquet,
    } from "parquet-wasm";

    // Instantiate the WebAssembly context
    await initWasm();

    // Given an existing arrow JS table under `table`
    const wasmTable = Table.fromIPCStream(tableToIPC(table, "stream"));
    const writerProperties = new WriterPropertiesBuilder()
    .setCompression(Compression.SNAPPY)
    .build();
    const parquetUint8Array = writeParquet(wasmTable, writerProperties);

    If writerProperties is not provided or is null, the default writer properties will be used. This is equivalent to new WriterPropertiesBuilder().build().

    Parameters

    • table: Table

      A Table representation in WebAssembly memory.

    • Optional writer_properties: WriterProperties

      (optional) Configuration for writing to Parquet. Use the WriterPropertiesBuilder to build a writing configuration, then call .build() to create an immutable writer properties to pass in here.

    Returns Uint8Array

    Uint8Array containing written Parquet data.