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

@ecmwf.int/tensogram

v0.21.0

Published

TypeScript bindings for the Tensogram N-tensor message format

Readme

@ecmwf.int/tensogram

TypeScript bindings for Tensogram, a binary message format for N-dimensional scientific tensors. Tensogram is developed and maintained by ECMWF.

Wraps the Rust core (via WebAssembly) with a typed, idiomatic TS API:

  • Strong types for metadata, descriptors, dtypes, and errors
  • Dtype-aware payload dispatch (object.data() returns the correct TypedArray)
  • Web Streams API for progressive decode (decodeStream)
  • Node + browser file helpers with HTTP Range support (TensogramFile)
  • Layout-aware remote readsmessageMetadata, messageDescriptors, messageObject, messageObjectRange, messageObjectBatch, messageObjectRangeBatch, prefetchLayouts; on the lazy HTTP backend each fetches only the bytes it needs (header chunk, footer suffix, per-object frame), with bounded-concurrency fan-out
  • AWS SigV4 helpercreateAwsSigV4Fetch plugs into TensogramFile.fromUrl({ fetch }) for read-only S3-compatible endpoints; pure signer at signAwsV4Request for byte-for-byte AWS sig-v4-test-suite parity
  • Full API parity with Rust / Python / C++ (encode/decode/validate, streaming encoder, pre-encoded bytes, first-class half-precision + complex view classes)

Install

Not yet published to npm. Build from source:

# From the repo root
cd typescript
npm install
npm run build     # wasm-pack + tsc

Requirements:

Quick start

import { init, encode, decode } from '@ecmwf.int/tensogram';

await init();

const temps = new Float32Array(100 * 200);
for (let i = 0; i < temps.length; i++) temps[i] = 273.15 + i / 100;

const msg = encode(
  { version: 3 },
  [{
    descriptor: {
      type: 'ntensor', ndim: 2,
      shape: [100, 200], strides: [200, 1],
      dtype: 'float32', byte_order: 'little',
      encoding: 'none', filter: 'none', compression: 'none',
    },
    data: temps,
  }],
);

const { metadata, objects } = decode(msg);
console.log(objects[0].data());  // Float32Array(20000)

See the user guide for the full API and examples/typescript/ for runnable scripts.

Remote access

TensogramFile.fromUrl opens a .tgm over HTTP(S) with Range support detection. When the server advertises Accept-Ranges: bytes it falls into the lazy backend, which fetches only the bytes you ask for:

const file = await TensogramFile.fromUrl(
  'https://example.org/forecast.tgm',
  { concurrency: 6 },               // per-host fan-out cap (default 6)
);
try {
  // Header chunk only — no payload bytes downloaded.
  const meta = await file.messageMetadata(0);

  // Index frame + per-frame CBOR descriptors.
  const { descriptors } = await file.messageDescriptors(0);

  // Exactly one Range GET for object 0's frame.
  const obj = await file.messageObject(0, 0);
  try {
    const arr = obj.objects[0].data() as Float32Array;
    // ... use arr ...
  } finally {
    obj.close();
  }

  // Pre-warm layout cache for all messages, bounded to 6 concurrent fetches.
  await file.prefetchLayouts(
    Array.from({ length: file.messageCount }, (_, i) => i),
  );

  // Parallel decode the same object across many messages.
  const xs = await file.messageObjectBatch([0, 1, 2, 3], 0);
  xs.forEach((x) => x.close());
} finally {
  file.close();
}

For S3-compatible endpoints behind AWS Signature V4 authentication, build a signed fetch and pass it through FromUrlOptions.fetch:

import { createAwsSigV4Fetch, TensogramFile } from '@ecmwf.int/tensogram';

const signedFetch = createAwsSigV4Fetch({
  accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
  region: 'eu-west-1',
});

const file = await TensogramFile.fromUrl(
  'https://my-bucket.s3.eu-west-1.amazonaws.com/data.tgm',
  { fetch: signedFetch },
);

The pure signer (signAwsV4Request) is also exported for callers that want to handle the request lifecycle themselves. Both are covered by byte-for-byte AWS sig-v4-test-suite parity tests.

For Azure or Google Cloud Storage, generate a presigned (signed) URL in your control plane and pass it as a plain HTTPS URL — Azure Shared Key signing and GCS HMAC are out of scope for this package.

For runnable end-to-end demos, see examples/typescript/15_remote_access.ts, 16_remote_batch.ts, and 17_remote_s3_signed_fetch.ts.

Licence

Apache 2.0 — see LICENSE.