Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Stream #4

Open
hyrious opened this issue Dec 20, 2023 · 0 comments
Open

Support Stream #4

hyrious opened this issue Dec 20, 2023 · 0 comments

Comments

@hyrious
Copy link
Owner

hyrious commented Dec 20, 2023

Since Node.js 18, ReadableStream and WritableStream are available from the global scope, which means now we can use the same stream APIs across runtimes:

  • chrome
  • Node.js
  • deno

So maybe we can add stream support to this library.

function loadStream(stream: ReadableStream<Uint8Array>): Promise<unknown>
function dumpToStream(value: unknown, stream: WritableStream): void

Since the final value should be returned to the user, a trivial implementation could be that: Write a fast skiping function to concat chunks of a Uint8Array that holds a marshaled value, then pass it to the existing load().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant