hyparquet/test/helpers.js
2024-07-26 15:07:47 -07:00

23 lines
462 B
JavaScript

import fs from 'fs'
/**
* Read .parquet file into JSON
*
* @param {string} filePath
* @returns {any}
*/
export function fileToJson(filePath) {
const buffer = fs.readFileSync(filePath)
return JSON.parse(buffer.toString())
}
/**
* Make a DataReader from bytes
*
* @param {number[]} bytes
* @returns {import('../src/types.js').DataReader}
*/
export function reader(bytes) {
return { view: new DataView(new Uint8Array(bytes).buffer), offset: 0 }
}