Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "hyparquet", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "parquet file parser for javascript", | ||
@@ -24,4 +24,2 @@ "keywords": [ | ||
"coverage": "vitest run --coverage --coverage.include=src", | ||
"demo": "http-server -o", | ||
"demo:build": "rollup -c", | ||
"lint": "eslint .", | ||
@@ -31,23 +29,11 @@ "test": "vitest run" | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "28.0.1", | ||
"@rollup/plugin-node-resolve": "15.3.0", | ||
"@rollup/plugin-replace": "6.0.1", | ||
"@rollup/plugin-terser": "0.4.4", | ||
"@rollup/plugin-typescript": "12.1.1", | ||
"@types/node": "22.7.5", | ||
"@types/react": "18.3.11", | ||
"@types/react-dom": "18.3.1", | ||
"@vitest/coverage-v8": "2.1.3", | ||
"eslint": "9.12.0", | ||
"eslint-plugin-jsdoc": "50.4.1", | ||
"hightable": "0.5.3", | ||
"http-server": "14.1.1", | ||
"@types/node": "22.8.6", | ||
"@vitest/coverage-v8": "2.1.4", | ||
"eslint": "9.14.0", | ||
"eslint-plugin-jsdoc": "50.4.3", | ||
"hyparquet-compressors": "0.1.4", | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1", | ||
"rollup": "4.24.0", | ||
"typescript": "5.6.3", | ||
"typescript-eslint": "8.9.0", | ||
"vitest": "2.1.3" | ||
"typescript-eslint": "8.12.2", | ||
"vitest": "2.1.4" | ||
} | ||
} |
@@ -23,6 +23,8 @@ # hyparquet | ||
https://hyparam.github.io/hyparquet/ | ||
[https://hyparam.github.io/hyperparam-cli/apps/hyparquet-demo/](https://hyparam.github.io/hyperparam-cli/apps/hyparquet-demo/) | ||
[![hyparquet demo](demo/assets/demo.png)](https://hyparam.github.io/hyparquet/) | ||
[![hyparquet demo](./demo.png)](https://hyparam.github.io/hyperparam-cli/apps/hyparquet-demo/) | ||
See the [source code](https://github.com/hyparam/hyperparam-cli/tree/master/apps/hyparquet-demo). | ||
## Features | ||
@@ -65,2 +67,4 @@ | ||
The `hyparquet` package is an ES module and is not packaged as a CommonJS module. That's why you need to use a dynamic import to load the module in Node.js. | ||
### Browser | ||
@@ -67,0 +71,0 @@ |
@@ -43,6 +43,7 @@ /** | ||
* @param {string} url | ||
* @param {RequestInit} [requestInit] fetch options | ||
* @returns {Promise<number>} | ||
*/ | ||
export async function byteLengthFromUrl(url) { | ||
return await fetch(url, { method: 'HEAD' }) | ||
export async function byteLengthFromUrl(url, requestInit) { | ||
return await fetch(url, { ...requestInit, method: 'HEAD' }) | ||
.then(res => { | ||
@@ -60,9 +61,12 @@ if (!res.ok) throw new Error(`fetch head failed ${res.status}`) | ||
* @typedef {import('./types.js').AsyncBuffer} AsyncBuffer | ||
* @param {string} url | ||
* @param {number} [byteLength] | ||
* @param {object} options | ||
* @param {string} options.url | ||
* @param {number} [options.byteLength] | ||
* @param {RequestInit} [options.requestInit] | ||
* @returns {Promise<AsyncBuffer>} | ||
*/ | ||
export async function asyncBufferFromUrl(url, byteLength) { | ||
export async function asyncBufferFromUrl({ url, byteLength, requestInit }) { | ||
// byte length from HEAD request | ||
byteLength ||= await byteLengthFromUrl(url) | ||
byteLength ||= await byteLengthFromUrl(url, requestInit) | ||
const init = requestInit || {} | ||
return { | ||
@@ -72,6 +76,6 @@ byteLength, | ||
// fetch byte range from url | ||
const headers = new Headers() | ||
const headers = new Headers(init.headers) | ||
const endStr = end === undefined ? '' : end - 1 | ||
headers.set('Range', `bytes=${start}-${endStr}`) | ||
const res = await fetch(url, { headers }) | ||
const res = await fetch(url, { ...init, headers }) | ||
if (!res.ok || !res.body) throw new Error(`fetch failed ${res.status}`) | ||
@@ -78,0 +82,0 @@ return res.arrayBuffer() |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
116555
8
3026
261
3