Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
This is the revision history of @msgpack/msgpack

## v1.3.0 2019/05/29

https://github.com/msgpack/msgpack-javascript/compare/v1.2.3...v1.3.0

* Add `decodeArrayStream()` to decode an array and returns `AsyncIterable<unknown>` [#42](https://github.com/msgpack/msgpack-javascript/pull/42)
* Add `decodeStream()` to decode an unlimited data stream [#46](https://github.com/msgpack/msgpack-javascript/pull/46)
* Let `decodeAsync()` and `decodeArrayStream()` to take `ReadalbeStream<Uint8Array | ArrayLike<number>>` (whatwg-streams) [#43](https://github.com/msgpack/msgpack-javascript/pull/46)

## v1.2.3 2019/05/29

https://github.com/msgpack/msgpack-javascript/compare/v1.2.2...v1.2.3
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,24 @@ maxExtLength | number | `4_294_967_295` (UINT32_MAX)

You can use `max${Type}Length` to limit the length of each type decoded.

### `decodeAsync(stream: AsyncIterable<ArrayLike<number> | Uint8Array>, options?: DecodeAsyncOptions): Promise<unknown>`
### `decodeAsync(stream: AsyncIterable<Uint8Array | ArrayLike<number>> | ReadableStream<Uint8Array | ArrayLike<number>>, options?: DecodeAsyncOptions): Promise<unknown>`

It decodes `stream` in an async iterable of byte arrays and returns decoded data as `uknown` wrapped in `Promise`. This function works asyncronously.

Note that `decodeAsync()` acceps the same options as `decode()`.

### `decodeArrayStream(stream: AsyncIterable<Uint8Array | ArrayLike<number>> | ReadableStream<Uint8Array | ArrayLike<number>>, options?: DecodeAsyncOptions): AsyncIterable<unknown>`

It is alike to `decodeAsync()`, but only accepts an array of items as the input `stream`, and emits the decoded item one by one.

It throws errors when the input is not an array.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add example scripts (and add it to test/readme.test.ts) in a future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think we need code example for it


### `decodeStream(stream: AsyncIterable<Uint8Array | ArrayLike<number>> | ReadableStream<Uint8Array | ArrayLike<number>>, options?: DecodeAsyncOptions): AsyncIterable<unknown>`

It is like to `decodeAsync()` and `decodeArrayStream()`, but the input `stream` consists of independent MessagePack items.

In other words, it decodes an unlimited stream and emits an item one by one.

### Extension Types

To handle [MessagePack Extension Types](https://github.com/msgpack/msgpack/blob/master/spec.md#extension-types), this library provides `ExtensionCodec` class.
Expand Down