Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stream.Readable.from #6

Closed
Richienb opened this issue Sep 3, 2020 · 4 comments
Closed

Use stream.Readable.from #6

Richienb opened this issue Sep 3, 2020 · 4 comments

Comments

@Richienb
Copy link
Contributor

Richienb commented Sep 3, 2020

stream.Readable.from was added in Node.js v12.3.0 and v10.17.0, allowing for easier conversion to Readable Streams:

const {Readable} = require('stream');

Readable.from('馃馃寛').pipe(process.stdout);

As well as this, it also supports generator functions:

const {Readable} = require('stream');

async function * generate() {
  yield '馃';
  yield '馃寛';
}

Readable.from(generate()).pipe(process.stdout);

Perhaps we could utilise this here?

// @sindresorhus

@sindresorhus
Copy link
Owner

Doesn't that API make this package moot?

@Richienb
Copy link
Contributor Author

Richienb commented Sep 3, 2020

@sindresorhus It does. We should either backport the generator function support or link to the API and deprecate this package.

@sindresorhus
Copy link
Owner

It's not feasible to use that API for Node.js 10 projects, since it's a recent addition, and from experience, no one updates Node.js minor versions. I have added a note in the readme about Node.js 12. I'll deprecate this package sometime in the future when Node.js 10 is obsolete.

@Richienb
Copy link
Contributor Author

Richienb commented Sep 3, 2020

I'll deprecate this package sometime in the future when Node.js 10 is obsolete

Node.js 10 End of life: 30 April 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants