Self-host the viewer
Package version — 0.5.1. The npm package contains the production viewer bundle. You can copy that bundle with chronozarr-viewer, or build the same viewer from a source checkout.
The viewer folder contains the page, one script for the viewer and reader, one for the decode worker, the codecs and their licenses. The viewer runs in the browser. The host only serves files. Node.js copies the files once and is not needed on the host.
Copy the viewer
-
Install the npm package in a JavaScript project:
npm install chronozarr@0.5.1 -
Copy the viewer into a new folder,
published/.npm exec -- chronozarr-viewer published --store ./store -
Copy your store into that folder.
cp -R /path/to/your/store published/store -
Upload
published/to a static host, and openindex.htmlthrough the host. A browser blocks the viewer's modules when the file opens from disk.
The folder works at a domain root or under a subpath. Sharded stores need a host that answers byte-range requests.
To preview the copied store and viewer on your machine, use chronozarr's local server. It handles bounded and suffix byte ranges:
chronozarr preview published/store --viewer-dir publishedPreview a local store with the copied viewer
chronozarr preview and chronozarr.view normally load the viewer from https://chronozarr.org/demo/. Pass the copied folder to serve the viewer from your own machine. No internet access is needed.
chronozarr preview my_store --viewer-dir publishedTo show a local store to a colleague for a short review, use chronozarr share my_store instead. It starts a temporary public link through cloudflared and uses the hosted viewer by default; keep the terminal and laptop running. See Share a temporary link. A copied viewer is useful when you need an offline viewer or one served on your own origin.
In a notebook, pass viewer_dir="published" to chronozarr.view or chronozarr.player. The folder needs demo/index.html, which the copy command writes. The same server serves the viewer and the store, so there is no CORS or mixed-content step. On JupyterHub the viewer and the store go through jupyter-server-proxy. See Explore a store in a notebook.
Use a store on another host
Give an absolute URL instead of a path:
npm exec -- chronozarr-viewer published --store https://example.org/my-storeThe host of the store must send CORS headers. See hosting requirements.
What the copy command does
- It refuses to overwrite a folder that exists.
- It copies the installed package's viewer. A browser reads
demo/viewer.jsin one request instead of fetching the source module graph. The WebAssembly codecs (demo/codecs/) and proj4 (demo/chunks/) load only when a store needs them. - It does not check or copy data.
- It writes an empty catalog. A store that fails to load never falls back to the public sample data.
Without --store, the landing page shows "No store selected". To choose a store, open demo/index.html?store=<URL> in the copied folder. For an iframe, add &embed=1. See embedding for the controls and the origin restriction.
Build from source
From the root of a source checkout, install the locked build dependencies and copy the viewer:
npm ci --prefix js --min-release-age=7
node js/support/viewer-bundle.mjs published --store ./storeThis builds the viewer before copying it. Use a new output folder for each build.
Test the package
Run npm run test:package from js/. The test packs the package and installs it in a new temporary folder. It checks that the copy command refuses to overwrite. It then renders a synthetic store from the copied viewer under a URL subpath. It checks the time controls, the pixel inspector and embedded rendering. It also checks that the page makes no outside requests and logs no browser errors.
The test uses the development Playwright installation.