Publish 1.6.1 - fix type of utils and update the doc (#44)

* Publish 1.6.1 - fix types

* update the doc
This commit is contained in:
Sylvain Lesage 2024-11-22 21:19:34 +01:00 committed by GitHub
parent c85d38eed5
commit e738643745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 4 deletions

@ -73,7 +73,16 @@ Hyparquet supports asynchronous fetching of parquet files over a network.
const { asyncBufferFromUrl, parquetRead } = await import('https://cdn.jsdelivr.net/npm/hyparquet/src/hyparquet.min.js')
const url = 'https://hyperparam-public.s3.amazonaws.com/bunnies.parquet'
await parquetRead({
file: await asyncBufferFromUrl(url),
file: await asyncBufferFromUrl({url}),
onComplete: data => console.log(data)
})
```
Pass the `requestInit` option to authenticate, for example:
```js
await parquetRead({
file: await asyncBufferFromUrl({url, requestInit: {headers: {Authorization: 'Bearer my_token'}}}),
onComplete: data => console.log(data)
})
```

@ -1,6 +1,6 @@
{
"name": "hyparquet",
"version": "1.6.0",
"version": "1.6.1",
"description": "parquet file parser for javascript",
"keywords": [
"parquet",

6
src/hyparquet.d.ts vendored

@ -117,8 +117,9 @@ export function toJson(obj: any): any
/**
* Construct an AsyncBuffer for a URL.
* If byteLength is not provided, will make a HEAD request to get the file size.
* If requestInit is provided, it will be passed to fetch.
*/
export function asyncBufferFromUrl(url: string, byteLength?: number): Promise<AsyncBuffer>
export function asyncBufferFromUrl({url, byteLength, requestInit}: {url: string, byteLength?: number, requestInit?: RequestInit}): Promise<AsyncBuffer>
/**
* Construct an AsyncBuffer for a local file using node fs package.
@ -127,8 +128,9 @@ export function asyncBufferFromFile(filename: string): Promise<AsyncBuffer>
/**
* Get the byte length of a URL using a HEAD request.
* If requestInit is provided, it will be passed to fetch.
*/
export function byteLengthFromUrl(url: string): Promise<number>
export function byteLengthFromUrl(url: string, requestInit?: RequestInit): Promise<number>
/**
* Returns a cached layer on top of an AsyncBuffer.