|
1 | 1 | # @zarrita/core
|
2 | 2 |
|
| 3 | +## 0.1.0-next.5 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- feat: Add `tryWithConsolidated` store helper ([#141](https://github.com/manzt/zarrita.js/pull/141)) |
| 8 | + |
| 9 | + Provides a convenient way to open a store that may or may not have consolidated |
| 10 | + metadata. Ideal for usage senarios with known access paths, since store with |
| 11 | + consolidated metadata do not incur additional network requests when accessing |
| 12 | + underlying groups and arrays. |
| 13 | + |
| 14 | + ```js |
| 15 | + import * as zarr from "zarrita"; |
| 16 | + |
| 17 | + let store = await zarr.tryWithConsolidated( |
| 18 | + new zarr.FetchStore("https://localhost:8080/data.zarr"); |
| 19 | + ); |
| 20 | + |
| 21 | + // The following do not read from the store |
| 22 | + // (make network requests) if it is consolidated. |
| 23 | + let grp = await zarr.open(store, { kind: "group" }); |
| 24 | + let foo = await zarr.open(grp.resolve("foo"), { kind: "array" }); |
| 25 | + ``` |
| 26 | + |
| 27 | +- feat: Add `withConsolidated` store utility ([#119](https://github.com/manzt/zarrita.js/pull/119)) |
| 28 | + |
| 29 | + **BREAKING**: Replaces [`openConsolidated`](https://github.com/manzt/zarrita.js/pull/91) |
| 30 | + to provide a consistent interface for accessing consolidated and non-consolidated stores. |
| 31 | + |
| 32 | + ```javascript |
| 33 | + import * as zarr from "zarrita"; |
| 34 | + |
| 35 | + // non-consolidated |
| 36 | + let store = new zarr.FetchStore("https://localhost:8080/data.zarr"); |
| 37 | + let grp = await zarr.open(store); // network request for .zgroup/.zattrs |
| 38 | + let foo = await zarr.open(grp.resolve("/foo"), { kind: array }); // network request for .zarray/.zattrs |
| 39 | + |
| 40 | + // consolidated |
| 41 | + let store = new zarr.FetchStore("https://localhost:8080/data.zarr"); |
| 42 | + let consolidatedStore = await zarr.withConsolidated(store); // opens ./zmetadata |
| 43 | + let contents = consolidatedStore.contents(); // [ {path: "/", kind: "group" }, { path: "/foo", kind: "array" }, ...] |
| 44 | + let grp = await zarr.open(consolidatedStore); // no network request |
| 45 | + let foo = await zarr.open(grp.resolve(contents[1].path), { |
| 46 | + kind: contents[1].kind, |
| 47 | + }); // no network request |
| 48 | + ``` |
| 49 | + |
3 | 50 | ## 0.1.0-next.4
|
4 | 51 |
|
5 | 52 | ### Patch Changes
|
|
0 commit comments