日本語のREADMEはこちらです: README.ja.md
This library is an implementation of MessagePack for TypeScript and JavaScript, providing a compact and efficient binary serialization format. Learn more about MessagePack at:
This library serves as a comprehensive reference implementation of MessagePack for JavaScript with a focus on accuracy, compatibility, interoperability, and performance.
import { MessagePack } from "https://code4fukui.github.io/MessagePack/MessagePack.js";
const object = {
nil: null,
integer: 1,
float: Math.PI,
string: "Hello, world!",
binary: Uint8Array.from([1, 2, 3]),
array: [10, 20, 30],
map: { foo: "bar" },
timestampExt: new Date(),
};
const encoded = MessagePack.encode(object);
console.log(encoded);
const obj = MessagePack.decode(encoded);
console.log(obj);It encodes data into a single MessagePack-encoded object, and returns a byte array as Uint8Array.
It decodes buffer that includes a MessagePack-encoded object, and returns the decoded object typed unknown.
decodeMulti(buffer: ArrayLike<number> | BufferSource, options?: DecoderOptions): Generator<unknown, void, unknown>
It decodes buffer that includes multiple MessagePack-encoded objects, and returns decoded objects as a generator.
decodeAsync(stream: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions): Promise<unknown>
It decodes a MessagePack-encoded object from a readable stream asynchronously.
decodeArrayStream(stream: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions): AsyncIterable<unknown>
It decodes an array of MessagePack-encoded objects from a readable stream asynchronously.
decodeMultiStream(stream: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions): AsyncIterable<unknown>
It decodes multiple MessagePack-encoded objects from a readable stream asynchronously.
This library supports extension types, which can be used to encode and decode custom data types.
This library provides a way to decode a large array of floating point numbers more efficiently.
You can decode a Blob instance that contains MessagePack-encoded data.
This library follows the MessagePack specification.
This library requires the following environments:
- ECMA-262
- Node.js
- TypeScript Compiler / Type Definitions
This library has been benchmarked against other MessagePack implementations for JavaScript.
This library is available through the following distribution channels:
- NPM / npmjs.com
- CDN / unpkg.com
This library can be used in Deno environments.
This library can be used in Bun environments.
This library is actively maintained, with the following practices:
- Testing
- Continuous Integration
- Release Engineering
- Updating Dependencies
MIT License — see LICENSE.