manzt / zarrita.js

A JavaScript toolkit for working with chunked, compressed, n-dimensional arrays
https://zarrita.dev
MIT License
39 stars 5 forks source link

feat(storage): support partial reads #93

Closed manzt closed 1 year ago

manzt commented 1 year ago

Introduces the Readable.getRange method, which can be optionally implemented by a store to support partial reads. The RangeQuery param is inspired by the HTTP Range header. Allowing the suffixLength query means the store can decide the best way to return the final N bytes from a file.

const store = new FetchStore("http://localhost:8080/data.zarr");
await store.getRange("/foo.json", { suffixLength: 100 });
await store.getRange("/foo.json", { offset: 10, length: 20 });

cc @andersy005