You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It encodes `data` and returns a byte array as `Uint8Array`, throwing errors if `data` is, or includes, a non-serializable object such as `function` or a `symbol`.
47
+
It encodes `data` and returns a byte array as `Uint8Array`, throwing errors if `data` is, or includes, a non-serializable object such as a `function` or a `symbol`.
48
+
49
+
for example:
50
+
51
+
```typescript
52
+
import { encode } from"@msgpack/msgpack";
53
+
54
+
const encoded:Uint8Array=encode({ foo: "bar" });
55
+
console.log(encoded);
56
+
```
48
57
49
58
#### EncodeOptions
50
59
@@ -61,6 +70,16 @@ It decodes `buffer` encoded as MessagePack, and returns a decoded object as `ukn
61
70
62
71
`buffer` must be an array of bytes, which is typically `Uint8Array`.
To handle [MessagePack Extension Types](https://github.com/msgpack/msgpack/blob/master/spec.md#extension-types), this library provides `ExtensionCodec` class.
0 commit comments