mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-05 22:41:55 +00:00
* build types before publishing to npm * use prepare instead of prepublishOnly + make it clear that we only build types doc for prepare vs prepublishOnly is here: https://docs.npmjs.com/cli/v8/using-npm/scripts * no jsx in this lib * relative imports from the root, so that it works from types/ * remove unused hyparquet.d.ts + report differences to jsdoc in files * try to understand if this is the cause of the failing CI check tsc fails: https://github.com/hyparam/hyparquet/actions/runs/12040954822/job/33571851170?pr=46 * Revert "try to understand if this is the cause of the failing CI check" This reverts commit 5e2fc8ca179064369de71793ab1cda3facefddc7. * not sure what happens, but we just need to ensure the types are created correctly * increment version * Explicitly export types for use in downstream typescript projects * Use new typescript jsdoc imports for smaller package * Combine some files and use @import jsdoc * use the local typescript --------- Co-authored-by: Kenny Daniel <platypii@gmail.com>
24 lines
485 B
JavaScript
24 lines
485 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
|
|
*
|
|
* @import {DataReader} from '../src/types.d.ts'
|
|
* @param {number[]} bytes
|
|
* @returns {DataReader}
|
|
*/
|
|
export function reader(bytes) {
|
|
return { view: new DataView(new Uint8Array(bytes).buffer), offset: 0 }
|
|
}
|