Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

refactor(deps): Remove get-stream in favor of async iterators - #1925

Merged
ddelgrosso1 merged 4 commits into
googleapis:mainfrom
ddelgrosso1:remove-get-stream
May 16, 2022
Merged

ddelgrosso1 merged 4 commits into
googleapis:mainfrom
ddelgrosso1:remove-get-stream

Conversation

@ddelgrosso1

Copy link
Copy Markdown
Contributor

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1909 🦕

@ddelgrosso1
ddelgrosso1 requested review from a team May 12, 2022 18:10
@product-auto-label product-auto-label Bot added size: s Pull request size is small. api: storage Issues related to the googleapis/nodejs-storage API. labels May 12, 2022
@ddelgrosso1 ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@ddelgrosso1 ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
Comment thread src/file.ts Outdated
}

private async getBufferFromReadable(readable: Readable): Promise<Buffer> {
readable.once('error', e => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broke other things... investigating a better way.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ddelgrosso1 ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@ddelgrosso1 ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(deps): Remove get-stream dependency

2 participants