hyparquet/src/hyparquet.d.ts

57 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-01-15 19:10:26 +00:00
export { AsyncBuffer, FileMetaData } from './types'
2024-01-07 23:33:24 +00:00
2024-01-04 19:11:00 +00:00
/**
* Read parquet data rows from a file
*
* @param {ArrayBuffer} arrayBuffer parquet file contents
* @returns {any[][]} row data
*/
export function parquetRead(arrayBuffer: ArrayBuffer): any[][]
2024-01-15 19:10:26 +00:00
/**
* Read parquet metadata from an async buffer.
*
* An AsyncBuffer is like an ArrayBuffer, but the slices are loaded
* asynchronously, possibly over the network.
*
* To make this efficient, we initially request the last 512kb of the file,
* which is likely to contain the metadata. If the metadata length exceeds the
* initial fetch, 512kb, we request the rest of the metadata from the AsyncBuffer.
*
* This ensures that we either make one 512kb initial request for the metadata,
* or two requests for exactly the metadata size.
*
* @param {AsyncBuffer} asyncBuffer parquet file contents
* @param {number} initialFetchSize initial fetch size in bytes (default 512kb)
* @returns {Promise<FileMetaData>} metadata object
*/
export async function parquetMetadataAsync(asyncBuffer: ArrayBuffer, initialFetchSize: number = 1 << 19 /* 512kb */): Promise<FileMetaData>
2024-01-04 19:11:00 +00:00
/**
2024-01-15 19:10:26 +00:00
* Read parquet metadata from a buffer
2024-01-04 19:11:00 +00:00
*
* @param {ArrayBuffer} arrayBuffer parquet file contents
* @returns {FileMetaData} metadata object
*/
2024-01-07 04:27:18 +00:00
export function parquetMetadata(arrayBuffer: ArrayBuffer): FileMetaData
2024-01-04 19:45:37 +00:00
/**
* Decompress snappy data.
* Accepts an output buffer to avoid allocating a new buffer for each call.
*
* @param {Uint8Array} inputArray compressed data
* @param {Uint8Array} outputArray output buffer
* @returns {boolean} true if successful
*/
export function snappyUncompress(inputArray: Uint8Array, outputArray: Uint8Array): boolean
2024-01-05 09:39:59 +00:00
/**
* Replace bigints with numbers.
* When parsing parquet files, bigints are used to represent 64-bit integers.
* However, JSON does not support bigints, so it's helpful to convert to numbers.
*
* @param {any} obj object to convert
* @returns {unknown} converted object
*/
export function toJson(obj: any): unknown