Examples
The repository’s examples/ directory contains four self-contained applications. Each has its own package.json and README. Clone the repo, cd into one, and follow its README.
Opens a FITS file from disk, lists its HDUs, and prints a small cutout from the primary HDU. Ships its own copy of an HST/FOS multi-extension file, so it runs without arguments. Pass a path to point it at your own file.
Covers: NodeFileReader.open, openFits, readImage with a region.
Points HttpRangeReader at a FITS file on the NASA FITS Support Office’s public sample tree, enumerates HDUs, and reads a cutout from the first 2D image HDU. Only the byte ranges those calls need cross the network.
Covers: HttpRangeReader, lazy enumeration over HTTP, cutouts from a remote file.
A file picker in the browser. Wraps the picked File in a BlobReader, lists HDUs, and prints cutout values to the page. Vite serves it in dev mode.
Covers: BlobReader, openFits and readImage in the browser.
A file picker that renders the first 2D image HDU to a canvas as 8-bit grayscale, with a percentile stretch and the FITS Y-flip. The landing page of this site renders the Horsehead with the same approach.
Covers: full-image decode, display scaling, canvas rendering in user code.
Running an example
Section titled “Running an example”The Node examples build with tsc and run as plain scripts. From inside an example directory:
pnpm installpnpm build && node dist/main.jsThe browser examples use Vite:
pnpm installpnpm devCI builds and lints every example on each PR, so they stay current against the API. Running them is manual.