npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nirs4all/formats-wasm

v0.2.0

Published

WebAssembly bindings for nirs4all-formats.

Readme

nirs4all-formats (WebAssembly / JS)

Browser- and Node-friendly bridge to the nirs4all-formats Rust core. It runs the format sniffers and the decoders entirely in WebAssembly, from in-memory bytes — no filesystem required.

Build

# Browser (ES modules)
wasm-pack build bindings/wasm --target web --release
# Node.js / Bun
wasm-pack build bindings/wasm --target nodejs --release --out-dir pkg-node

This emits the nirs4all-formats-wasm package (JS glue + .wasm + TypeScript typings) under pkg/ (or pkg-node/).

Surface

import init, {
  version, features, readerCatalog, probeBytes, openBytes, openWithSidecars,
} from "./pkg/nirs4all_formats_wasm.js";

await init();

version();   // "0.1.0-alpha.1"
features();  // { hdf5: true, matlab: true, parquet: true }
readerCatalog(); // [{ reader: "nirs4all_formats::readers::jcamp" }, ...]

const bytes = new Uint8Array(await file.arrayBuffer());

// Sniff: ordered candidate readers, best first
probeBytes(file.name, bytes);
// [{ format: "jcamp-dx", reader: "...", confidence: "definite", reason: "..." }]

// Decode: SpectralRecord[] (same JSON shape as `nirs4all-formats read-json`)
const records = openBytes(file.name, bytes);

openBytes / probeBytes take the file name (several sniffers disambiguate by extension) plus the bytes. The returned records match the data model: signals, signal_type, targets, metadata, provenance, quality_flags.

Sidecar formats

Multi-file formats (ENVI Standard .img+.hdr, ENVI SLI, AVIRIS/ERDAS LAN, FGI XML+HDF5, NetCDF MFRSR) return an UnsupportedSidecar error from openBytes. Supply the companions as a { name: Uint8Array } map instead:

const records = openWithSidecars("cube.img", imgBytes, { "cube.hdr": hdrBytes });

Scope & feature flags

The default WASM build compiles fmt-hdf5, fmt-matlab, and fmt-parquet on. HDF5/NetCDF-backed readers, MATLAB MAT/RData readers, and Parquet table readers are available in the browser, including snappy, uncompressed, and zstd-compressed Parquet pages. Call features() to check the active bundle at runtime.

Smoke test

node bindings/wasm/tests/smoke.js
node bindings/wasm/tests/sidecars.test.js
node bindings/wasm/tests/fixture_matrix.js

smoke.js loads committed fixtures (CSV, JCAMP-DX, ASD binary, a non-data PDF) and asserts the probe routes each to the expected reader; sidecars.test.js exercises openWithSidecars. fixture_matrix.js opens a wider set of committed single-file and sidecar fixtures through the WASM package, checks expected non-NIRS/refusal paths, and compares the exercised readers to readerCatalog(). The committed matrix covers every compiled reader except Allotrope ADF, whose sample is local-only/non-redistributable; see samples/allotrope_adf/README.md.