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: add `withConsolidated` store helper #119

Closed manzt closed 7 months ago

manzt commented 11 months ago

Towards #117

Introduces the withConsolidated store helper (?). Looks for v2 consolidated metadata, and returns known contents. "Opening" paths from the store is essentially free for consolidated data (and will not make a network request)

let store = await withConsolidated(new FetchStore("http://localhost:8080"));
let contents = store.contents() // [ {path: "/", kind: "group" }, { path: "/foo", kind: "array" }, ...]
let foo = await open(contents[1].path, { kind: "array" });