Skip to content

Getting Started ​

Upgrading from v0.6?

v0.7.0 contains one breaking change and one deprecation. See the v0.7 migration guide for details.

zarrita supports a variety of environments, including the browser, Node.js, and Deno.

Try Zarr online ​

You can try out zarrita on Observable! Fork the example notebook and try loading some of your own data.

Zarr in vanilla HTML ​

In vanilla HTML, you can load zarrita from a CDN such as jsDelivr or esm.sh or you can download it locally. We recommend using the CDN-hosted ES module bundle since it automatically loads the other dependencies.

html
<!DOCTYPE html>
<script type="module">
  import * as zarr from "https://cdn.jsdelivr.net/npm/zarrita/+esm";
  const store = new zarr.FetchStore("https://raw.githubusercontent.com/zarr-developers/zarr_implementations/5dc998ac72/examples/zarr.zr/blosc");
  const arr = await zarr.open(store, { kind: "array" });
  // {
  //   store: FetchStore,
  //   path: "/",
  //   dtype: "uint8",
  //   shape: [512, 512, 3],
  //   chunks: [100, 100, 1],
  // }
  const view = await zarr.get(arr, [null, null, 0]);
  // {
  //   data: Uint8Array,
  //   shape: [512, 512],
  //   stride: [512, 1],
  // }
</script>

Installing from npm ​

If you're developing an application with Node.js, you can install zarrita via yarn, npm, pnpm:

sh
npm install zarrita

You can then load zarrita modules into your app as:

javascript
import * as zarr from "zarrita";
const arr = await zarr.open(store);

or instead, import specific exports:

javascript
import { open } from "zarrita";
const arr = await open(store);

INFO

Bundlers like Rollup are smart enough to tree-shake namespace imports, so the above code will result in the same final bundle.

Released under the MIT License.