parquet-wasm - v0.9.0
    Preparing search index...

    Function writeParquet

    • 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().

      writeParquet takes ownership of table and writerProperties and frees them, so don't call .free() on either afterwards (it throws null pointer passed to rust) or pass them to another function (it throws Attempt to use a moved value). To write the same data again, create a new Table.

      Parameters

      • table: Table

        A Table representation in WebAssembly memory. Freed by this function.

      • Optionalwriter_properties: WriterProperties | null

        (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. Freed by this function.

      Returns Uint8Array

      Uint8Array containing written Parquet data.