Repository navigation
refactor(deps): Remove get-stream in favor of async iterators - #1925
Conversation
| } | ||
|
|
||
| private async getBufferFromReadable(readable: Readable): Promise<Buffer> { | ||
| readable.once('error', e => { |
There was a problem hiding this comment.
There seems to be some difference in how node < 16 handles errors with streams / async iterators. Test cases were failing with Node 12 / 14 until I explicitly handled a stream error. However, node 16 handled it with just the iterator.
There was a problem hiding this comment.
Broke other things... investigating a better way.
There was a problem hiding this comment.
Yea, this block handled the error a bit differently - the throw wouldn't populate in getBufferFromReadable, but would have a separate context as it is in a callback.
I actually don't think the catch is necessary - for await (const chunk of readable) { should populate the throw. E.g. https://nodejs.org/api/stream.html#readablesymbolasynciterator
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #1909 🦕