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

@cratestack/cbor-node

v0.8.10

Published

Native N-API CBOR codec for CrateStack's generated TypeScript clients, wrapping the framework's own cratestack-codec-cbor Rust crate (crates/cratestack-cbor-napi) for byte-identical wire behavior with the server and Rust client.

Readme

@cratestack/cbor-node

Native N-API CBOR codec for CrateStack's generated TypeScript RPC clients — a CratestackRpcCodec backed by the framework's own cratestack-codec-cbor Rust crate via native bindings (crates/cratestack-cbor-napi), not a JS reimplementation. Encode/decode output is byte-identical to what the CrateStack server and Rust client already produce for application/cbor.

Ships prebuilt per-platform binaries via optionalDependencies (the same pattern esbuild/@swc/core use) — no Rust toolchain needed to install or use this package.

See epic #285 and issue #286 for the full design context.

Usage

import { cborCodec } from "@cratestack/cbor-node";

const bytes = cborCodec.encode({ hello: "world", count: 1 });
const value = cborCodec.decode(bytes);

cborCodec structurally satisfies CratestackRpcCodec from @cratestack/ts-types, so it can be passed anywhere a generated client's runtime expects a codec — no explicit dependency on @cratestack/ts-types required at runtime, since it's checked via satisfies, not a type re-export.

Null handling

CBOR has a real null (RFC 8949 §3.3, simple value 22, byte 0xf6). cratestack-codec-cbor's underlying minicbor-serde backend has a documented quirk where a bare Rust unit type () encodes as the CBOR empty array marker (0x80) instead — this package's encode translates every JSON null (top-level or nested inside an object/array) through the code path that produces real CBOR null, matching CborCodec's own Option::None behavior byte-for-byte. See crates/cratestack-cbor-napi/src/json_value.rs for the detail.

Error handling

Malformed CBOR bytes passed to decode throw a catchable JS Error — never a native crash. Both native entry points also use napi-rs's catch_unwind to convert any unexpected Rust panic into a catchable exception instead of aborting the Node process.

Scope

Single-item encode/decode only — no CBOR-seq/streaming support (that's a separate concern; see epic #285). Not the default codec for generated clients (jsonRpcCodec remains the default) — this is an available, first-party option a project opts into.