FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

streams: implement Readable.from async iterator utility by guybedford · Pull Request #27660 · nodejs/node · GitHub

/ node Public

streams: implement Readable.from async iterator utility - #27660

Closed
guybedford wants to merge 1 commit into
nodejs:masterfrom
guybedford:readable-from
Closed

streams: implement Readable.from async iterator utility#27660
guybedford wants to merge 1 commit into
nodejs:masterfrom
guybedford:readable-from

Conversation

Copy link
Copy Markdown
Contributor

This implements a Readable.from utility method for easily converting async iterators into readable streams.

The implementation and approach are taken directly from the toReadable implementation in https://github.com/mcollina/stream-iterators-utils.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Copy link
Copy Markdown
Collaborator

nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label May 12, 2019
guybedford requested a review from mcollina May 12, 2019 17:05

devsnek commented May 12, 2019

Copy link
Copy Markdown
Member

fun fact: web streams are also async iterators :P

Comment thread lib/_stream_readable.js Outdated
Comment thread lib/_stream_readable.js Outdated
Comment thread test/parallel/test-readable-from.js Outdated
Comment thread test/parallel/test-readable-from.js Outdated

benjamingr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Added some comments, generally LGTM and 👍

Copy link
Copy Markdown
Member

fun fact: web streams are also async iterators :P

@devsnek oh cool that means you ended up following through and making that change?

Comment thread doc/api/stream.md Outdated
Comment thread lib/_stream_readable.js Outdated
Comment thread lib/_stream_readable.js Outdated
Comment thread doc/api/stream.md Outdated
Comment thread doc/api/stream.md Outdated
jasnell added the semver-minor PRs that contain new features and should be released in the next minor version. label May 12, 2019

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, awesome work!

benjamingr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is great, thanks for this and for the changes 🙇

I think this, its counterpart of readable streams being async iterable, once promisify, its counterpart callbackify and the promise warnings mean we finally have a good async story for Node.js

I'm excited :D

Comment thread doc/api/stream.md Outdated
Comment thread doc/api/stream.md Outdated

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

guybedford closed this May 18, 2019
guybedford added a commit that referenced this pull request May 18, 2019
PR-URL: #27660
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this pull request May 18, 2019
PR-URL: #27660
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
BridgeAR added a commit that referenced this pull request May 21, 2019
Notable changes:

* process:
  * Log errors using `util.inspect` in case of fatal exceptions
    (Ruben Bridgewater) #27243
* repl:
  * Add `process.on('uncaughtException')` support (Ruben Bridgewater)
    #27151
* stream:
  * Implemented `Readable.from` async iterator utility (Guy Bedford)
    #27660
* tls:
  * Expose built-in root certificates (Ben Noordhuis)
    #26415
  * Support `net.Server` options (Luigi Pinca)
    #27665
  * Expose `keylog` event on TLSSocket (Alba Mendez)
    #27654
* worker:
  * Added the ability to unshift messages from the `MessagePort`
    (Anna Henningsen) #27294
BridgeAR mentioned this pull request May 21, 2019
4 tasks
BridgeAR added a commit that referenced this pull request May 21, 2019
Notable changes:

* esm:
  * Added the `--experimental-wasm-modules` flag to support
    WebAssembly modules (Myles Borins & Guy Bedford)
    #27659
* process:
  * Log errors using `util.inspect` in case of fatal exceptions
    (Ruben Bridgewater) #27243
* repl:
  * Add `process.on('uncaughtException')` support (Ruben Bridgewater)
    #27151
* stream:
  * Implemented `Readable.from` async iterator utility (Guy Bedford)
    #27660
* tls:
  * Expose built-in root certificates (Ben Noordhuis)
    #26415
  * Support `net.Server` options (Luigi Pinca)
    #27665
  * Expose `keylog` event on TLSSocket (Alba Mendez)
    #27654
* worker:
  * Added the ability to unshift messages from the `MessagePort`
    (Anna Henningsen) #27294

PR-URL: #27799
BridgeAR added a commit that referenced this pull request May 21, 2019
Notable changes:

* esm:
  * Added the `--experimental-wasm-modules` flag to support
    WebAssembly modules (Myles Borins & Guy Bedford)
    #27659
* process:
  * Log errors using `util.inspect` in case of fatal exceptions
    (Ruben Bridgewater) #27243
* repl:
  * Add `process.on('uncaughtException')` support (Ruben Bridgewater)
    #27151
* stream:
  * Implemented `Readable.from` async iterator utility (Guy Bedford)
    #27660
* tls:
  * Expose built-in root certificates (Ben Noordhuis)
    #26415
  * Support `net.Server` options (Luigi Pinca)
    #27665
  * Expose `keylog` event on TLSSocket (Alba Mendez)
    #27654
* worker:
  * Added the ability to unshift messages from the `MessagePort`
    (Anna Henningsen) #27294

PR-URL: #27799
Comment thread doc/api/stream.md
(async function() {
for await (const chunk of iterator) {
// Handle backpressure on write
if (!writeable.write(value))

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

where does value come from?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should be chunk, feel free to open a PR.

imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
imcotton added a commit to imcotton/DefinitelyTyped that referenced this pull request Jun 11, 2019
BethGriggs pushed a commit that referenced this pull request Oct 17, 2019
PR-URL: #27660
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
BethGriggs mentioned this pull request Oct 18, 2019
BethGriggs added a commit that referenced this pull request Oct 22, 2019
Notable changes:

* crypto:
  * add support for chacha20-poly1305 for AEAD (chux0519)
    #24081
  * increase maxmem range from 32 to 53 bits (Tobias Nießen)
    #28799
* deps:
  * update npm to 6.11.3 (claudiahdz)
    #29430
  * upgrade openssl sources to 1.1.1d (Sam Roberts)
    #29921
* dns:
  * remove dns.promises experimental warning (cjihrig)
    #26592
* fs:
  * remove experimental warning for fs.promises (Anna Henningsen)
    #26581
* http:
  * makes response.writeHead return the response (Mark S. Everitt)
    #25974
* http2:
  * makes response.writeHead return the response (Mark S. Everitt)
    #25974
* n-api:
  * make func argument of napi\_create\_threadsafe\_function optional
    (legendecas)
    #27791
  * mark version 5 N-APIs as stable (Gabriel Schulhof)
    #29401
  * implement date object (Jarrod Connolly)
    #25917
* process:
  * add --unhandled-rejections flag (Ruben Bridgewater)
    #26599
* stream:
  * implement Readable.from async iterator utility (Guy Bedford)
    #27660
  * make Symbol.asyncIterator support stable (Matteo Collina)
    #26989

PR-URL: #29875
BethGriggs added a commit that referenced this pull request Oct 22, 2019
Notable changes:

* crypto:
  * add support for chacha20-poly1305 for AEAD (chux0519)
    #24081
  * increase maxmem range from 32 to 53 bits (Tobias Nießen)
    #28799
* deps:
  * update npm to 6.11.3 (claudiahdz)
    #29430
  * upgrade openssl sources to 1.1.1d (Sam Roberts)
    #29921
* dns:
  * remove dns.promises experimental warning (cjihrig)
    #26592
* fs:
  * remove experimental warning for fs.promises (Anna Henningsen)
    #26581
* http:
  * makes response.writeHead return the response (Mark S. Everitt)
    #25974
* http2:
  * makes response.writeHead return the response (Mark S. Everitt)
    #25974
* n-api:
  * make func argument of napi\_create\_threadsafe\_function optional
    (legendecas)
    #27791
  * mark version 5 N-APIs as stable (Gabriel Schulhof)
    #29401
  * implement date object (Jarrod Connolly)
    #25917
* process:
  * add --unhandled-rejections flag (Ruben Bridgewater)
    #26599
* stream:
  * implement Readable.from async iterator utility (Guy Bedford)
    #27660
  * make Symbol.asyncIterator support stable (Matteo Collina)
    #26989

PR-URL: #29875
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. semver-minor PRs that contain new features and should be released in the next minor version. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.


Back | FazBrowse Home | New Git URL