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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow transformation of stream output #243

Closed
wants to merge 1 commit into from

Conversation

ammarbinfaisal1
Copy link
Contributor

@ammarbinfaisal1 ammarbinfaisal1 commented May 14, 2019

I would update the tests and the docs; before that just wanted to ask whether there are anymore built-in transforming options needed?
I hope I understood the issue description correctly

@ehmicky
Copy link
Collaborator

ehmicky commented May 14, 2019

Hi @ammarbinfaisal, thanks a lot for the time spent on a new PR since last one (#189)!

Now I am wondering, wouldn't it be more straightforward (and easier to compose) for users to just do the following?

const { stdout } = await execa('echo', ['hello', 'world'])
const value = myTransform(stdout) 

I am asking in the spirit of "keeping it small".

What do you think @ammarbinfaisal and @sindresorhus?

@ammarbinfaisal1
Copy link
Contributor Author

I guess this would make more sense if the observable support mentioned in #20 is implemented. Unfortunately I've never used observables. btw you'd know better

@ehmicky
Copy link
Collaborator

ehmicky commented May 14, 2019

I might be understanding #20 but it seems like it's more about adding support for Observables.

When it comes to transforming the stdout and/or stderr, in buffered mode, this can be done easily at the moment (see code above). In streaming mode, it can also be done easily:

execa('echo', ['hello', 'world']).stdout.pipe(myStreamTransform)

If Observables were implemented, they would come with methods on their own to perform transforms. Or did I misunderstand something?

@ammarbinfaisal1
Copy link
Contributor Author

ammarbinfaisal1 commented May 14, 2019 via email

@ehmicky
Copy link
Collaborator

ehmicky commented May 14, 2019

Unless there is something I am not understanding about Observables, I think adding this option might already be easily done. Based on that, I would close this PR.

However I would like to know @sindresorhus opinion on this. Also feel free to let me know where I might be wrong.

@sindresorhus
Copy link
Owner

Yes, the original intention was for use with Observables.

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

Successfully merging this pull request may close these issues.

None yet

3 participants