| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
cc @nodejs/whatwg-stream |
Sorry, something went wrong.
|
Also, would this need node tests too? or WPTs are enough? |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
There was a problem hiding this comment.
Can't this be an async function which would allow the catch to not exist nd the below return PromiseResolve() to just be a return etc?
Sorry, something went wrong.
There was a problem hiding this comment.
Hmm i think it could, let me make it so and see if the WPTs pass
Sorry, something went wrong.
There was a problem hiding this comment.
Hey! updated this, the WPTs don't complain and reading the spec i doesn't seem to say anything about the function having to sync or async
Sorry, something went wrong.
There was a problem hiding this comment.
Indeed, this is equivalent. I wanted the error handling to be very explicit in the reference implementation, but practical implementations can be more succinct. 🙂
Sorry, something went wrong.
There was a problem hiding this comment.
Mostly LGTM (esp for a first version).
A few notes:
Sorry, something went wrong.
where to check for this? should make a issue on the spec repo? maybe @MattiasBuelens can help? |
Sorry, something went wrong.
|
have addressed all the comments and will wait for some time if we would like to add .toWeb functionality like @benjamingr suggested |
Sorry, something went wrong.
Sorry, something went wrong.
I would recommend something like: // at the top-level
// ideally, this is exported by `lib/internal/streams/readable.js`
const originalReadableAsyncIterator = Readable.prototype[Symbol.asyncIterator];
// in readableStreamFromIterable
if (iterable instanceof Readable && iterable[Symbol.asyncIterator] === originalReadableAsyncIterator) {
return Readable.toWeb(iterable);
}This way, you can be certain that you're dealing with an unmodified Readable, and that there will be no behavioral differences compared to "going the long way" using Readable's async iterator. I also suggest you write additional tests with polluted Readable instances, or with a polluted Readable.prototype. 😉 |
Sorry, something went wrong.
|
Hey one thing is it ok to export things from lib/internal/streams/readable.js something like originalReadableAsyncIterator as suggested? i know there is little bit restrictions in what we can export import in around the readable node stream part since its used in readablestream @benjamingr @mcollina |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
Hello everyone! I have reverted the change of toWeb for now (I shall do it in a follow up, since i was getting confused 😅) PTAL it seems ready to land! |
Sorry, something went wrong.
Fixes: nodejs#48389 PR-URL: nodejs#48395 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fixes: nodejs#48389 PR-URL: nodejs#48395 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fixes: nodejs#48389 PR-URL: nodejs#48395 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
| Back | FazBrowse Home | New Git URL |
Implements ReadableStream.from
Updating the WPTs add a lot of new tests, and failures that weren't relevant to this PR, I have added them to expected failures.
Please do take a look at the node errors used, I have used ERR_INVALID_STATE.TypeError in all the places since all the webstreams code seems to be reliant on that.
Fixes: #48389