-
Notifications
You must be signed in to change notification settings - Fork 11
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
Native stream #19
Comments
@jimmywarting if there is a hack, then I reckon I'll definitely include that in the README :) |
doe it is a different streaming api. |
chrome (and soon FF) implemented the new reading methods |
@jimmywarting Good to know! It seems that even when this API is available this package should still offer a Node.js stream interface. Folks who need WHATWG streams can just use |
right, ppl who want to use whatwg stream don't need this package. but if you really want to use something that is more cross platform supported (and don't want to care if it is a node or a whatwg stream) then you would treat both streams as a async iterable. // stream can be either a node stream of a whatwg stream
for await (let chunk of stream) {
console.log(chunk) // instance of Uint8array
} the only difference is that whatwg streams will yield a https://github.com/cross-js/cross-js#dont-create-node-or-web-readable-stream-yourself |
@jimmywarting Cool, thanks for explaining. This is exactly what I thought. Is there a cross-platform way to handle WHATWG + Node.js writable streams? |
like i wrote earlier // stream can be either a node stream of a whatwg stream
for await (let chunk of stream) {
console.log(chunk) // instance of Uint8array
} you could also do: const iterator = stream[symbol.asyncIterator]() // either node or whatwg stream
const result = await iterator.next() // { done: Boolean, value: Uint8Array } |
@jimmywarting I was asking about writable streams, i.e. sinks not sources! |
oh, sorry my mistake. |
Really? How about this hack? 😉
Anyhow, just wanted to share some light to alternative solutions, this is rather hacky but there is an issue for that at w3c/FileAPI#40
You can close this issue. suggest this in the readme or just discard this totally
The text was updated successfully, but these errors were encountered: