zarrita.js icon indicating copy to clipboard operation
zarrita.js copied to clipboard

Feature request: Mechanism to extend codec/filter registry

Open kleinschmidt opened this issue 1 month ago • 3 comments

This is related to #233 (and specifically this comment). For codecs/filters that are not currently supported, IIUC the only way to add support is to patch zarrita.js source itself.

The feature I'm requesting is a mechanism to register additional codecs/filters. I think this would be useful both as a way to

  1. decouple development of e.g. TS implementations of the python zarr.numcodecs codecs suite of codecs from the main zarrita.js source, as well as
  2. supporting truly custom third-party codecs.

I (and my colleagues) would be willing to take a crack at this with a bit of guidance!

kleinschmidt avatar Oct 31 '25 14:10 kleinschmidt

just a heads-up: if you plan on working with zarr v3, then I would not treat numcodecs as a reference for anything. the right reference for zarr v3 codecs is zarr-extensions. See https://github.com/zarr-developers/zarr-python/pull/3332#issuecomment-3457543346 for more context.

d-v-b avatar Oct 31 '25 14:10 d-v-b

I think this is a documentation issue: the exported registry map provides a way for applications to register their own codecs.

kleinschmidt avatar Nov 03 '25 21:11 kleinschmidt

Yes, sorry for the delay. Definitely a documentation thing. There have been a lot of changes in my work recently, should hopefully settle down in a couple of weeks.

Right now the mechanism for extending codecs is to use registry:

import * as zarr from "zarrita";
zarr.registry.set("codec", () => Codec);

const arr = await zarr.open(store, { kind: "array" })

Here's an example. I'm generally open to accepting PRs for various TypeScript implementations of codecs (since they likely don't contribute that much to bundle size), less so WASM. However, I do think there is some tension between v2 and v3 at the moment that might require some API redesigns.

manzt avatar Nov 04 '25 14:11 manzt