cbor-x icon indicating copy to clipboard operation
cbor-x copied to clipboard

Web/WhatWG Streams API Support

Open pojntfx opened this issue 1 year ago • 2 comments

Currently, this library supports the legacy NodeJS streams API (see https://github.com/kriszyp/cbor-x?tab=readme-ov-file#streams), but not the newer Web/WhatWG streams API (see https://developer.mozilla.org/en-US/docs/Web/API/Streams_API). While it is possible on NodeJS to convert from the legacy API to the the new web streams API with Readable.toWeb()/Writable.toWeb(), neither of these APIs are available in the browser, making it hard to use cbor-x's streaming decode/encode support correctly (with support for backpressure etc.) when reading from a Readable stream such as a fetch request body or a WebTransport stream.

Adding support for this new (and arguable simpler to implement) streams API natively would greatly simplify this library's use in the browser.

pojntfx avatar Feb 02 '24 23:02 pojntfx