-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(msgpack): complete documentation of the package (#4832)
- Loading branch information
1 parent
315005c
commit 0e31686
Showing
3 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
// This module is browser compatible. | ||
|
||
/** | ||
* MessagePack is an efficient binary serialization format that is language | ||
* agnostic. It is like JSON, but generally produces much smaller payloads. | ||
* [Learn more about MessagePack](https://msgpack.org/). | ||
* | ||
* This module provides functions to encode and decode MessagePack. | ||
* | ||
* ```ts | ||
* import { decode, encode } from "@std/msgpack"; | ||
* import { assertEquals } from "@std/assert" | ||
* | ||
* const obj = { | ||
* str: "deno", | ||
* arr: [1, 2, 3], | ||
* bool: true, | ||
* nil: null, | ||
* map: { | ||
* foo: "bar" | ||
* } | ||
* }; | ||
* | ||
* const encoded = encode(obj); | ||
* console.log(encoded); // Uint8Array(42) [...] | ||
* | ||
* const decoded = decode(encoded); | ||
* assertEquals(decoded, obj); | ||
* ``` | ||
* | ||
* MessagePack supports encoding and decoding the following types: | ||
* | ||
* - `number` | ||
* - `bigint` | ||
* - `string` | ||
* - `boolean` | ||
* - `null` | ||
* - `Uint8Array` | ||
* - arrays of values of these types | ||
* - objects with string or number keys, and values of these types | ||
* | ||
* @module | ||
*/ | ||
|
||
export * from "./decode.ts"; | ||
export * from "./encode.ts"; |