algo-msgpack-with-bigint

A zero-dependency MessagePack encoder and decoder for JS/TS with modified BigInt handling.

Library
npm
v2.1.1
1stars
ISC

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
18/100Needs Attention
Development Activity0
Maintenance0
Community12
Maturity60
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture80
Code Quality82
Innovation68
Learning Curve80

algo-msgpack-with-bigint is a fork of the reference @msgpack/msgpack implementation that encodes and decodes the MessagePack binary serialization format in pure JavaScript and TypeScript. Its key difference is changed BigInt behavior, which lets it round-trip large integers accurately, and it is best known as the MessagePack layer used by the Algorand JavaScript SDK.

It provides synchronous encode/decode functions plus async and streaming decoders, an extensible codec system for custom types, and a cached key decoder for fast repeated-key maps. The library ships with zero runtime dependencies and works in browsers, Node.js, and other ECMA-262 environments.

What You Get

  • Synchronous encode and decode functions for MessagePack buffers
  • Async and streaming decoders (decodeAsync, decodeArrayStream, decodeStream) for chunked input
  • An ExtensionCodec system for registering custom type extensions, including timestamps
  • A CachedKeyDecoder that speeds up decoding of maps with repeated string keys

Common Use Cases

  • Serializing Algorand transactions and blockchain payloads that contain large integers
  • Exchanging compact binary messages between a browser client and a server
  • Streaming and decoding large MessagePack payloads without buffering everything in memory

Under The Hood

Architecture - src/index.ts exports the public surface built around two core classes: Encoder.ts walks a JavaScript value and writes MessagePack bytes, while Decoder.ts reads bytes back into values, with thin encode.ts/decode.ts/decodeAsync.ts wrappers providing the ergonomic function API. Extensibility flows through ExtensionCodec.ts and ExtData.ts (with a built-in timestamp.ts extension), and CachedKeyDecoder.ts optimizes decoding of maps that reuse string keys. The fork’s distinguishing change is in the integer path, where large values are emitted as and parsed into BigInt.

Tech Stack - Pure TypeScript compiled to dist/, with zero runtime dependencies so it runs unchanged in browsers, Node.js, and other ECMA-262 hosts. It uses TypedArrays and DataViews for byte-level encoding rather than any external buffer library.

Code Quality - Test coverage is a clear strength: the test directory holds focused suites for BigInt, float, int, and timestamp codecs, plus blob, max-length, async, and streaming decode paths. The code is strictly typed and closely mirrors the well-regarded upstream @msgpack/msgpack implementation it forks from.

API Design - The everyday API is just encode(value) and decode(buffer), which keeps the common case trivial, while async, streaming, and custom-extension APIs are available when needed. Naming follows the MessagePack spec conventions, so anyone familiar with the format is immediately productive.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search