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

feature request: allow stream in File.save #98

Closed
fiws opened this issue Nov 30, 2017 · 5 comments
Closed

feature request: allow stream in File.save #98

fiws opened this issue Nov 30, 2017 · 5 comments
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@fiws
Copy link

fiws commented Nov 30, 2017

To avoid some boilerplate code with streams it would be nice to be able to pass a stream to File.save

Example

const read = fs.createReadStream('./somefile.bin');
const file = bucket.file(`test.bin`);
await file.save(read);
// do other stuff

This would be very useful when working with promises.

@callmehiphop
Copy link
Contributor

@fiws have you thought about using something like stream-to-promise? I think we're of the opinion that the streaming and non-streaming APIs shouldn't connect in that way.

@stephenplusplus
Copy link
Contributor

I would agree that stream-to-promise seems like the right way to go. I would be convinced otherwise if in the average app, we're the only API not accepting streams as an argument. That doesn't match my experience so far, which is why I'm slanted towards letting the module ecosystem solve this-- since it's probably not just us, a user would need a module like stream-to-promise for use with those other APIs.

However, I'm contradicting myself by suggesting stream-to-promise. If a lot of users are finding that useful, then it stands to reason it would be best to give users what they want.

What do you think @fiws? Obviously, you asked for the feature, but have you been able to make this work without the suggested change in a way that's not too cumbersome? Or do you feel even more strongly we should support this as time passed?

Considering the above, I would be okay with a PR for this, although I don't consider it urgent. Its value might increase in time.

@stephenplusplus stephenplusplus added priority: p2 Moderately-important priority. Fix may not be included in next release. type: enhancement labels Dec 11, 2017
@fiws
Copy link
Author

fiws commented Dec 11, 2017

Thanks for the response.

stream-to-promise is better than the awkward wrapper I have build. Thanks for suggesting that. It's good enough for my use case for now. :)

I would really like to see node figure out their promise/callback/event/stream mess. It feels like we're slowly moving towards a more promise based node core starting with util.promisify.

You can close this issue if it bothers you. I would still like the feature though.

@stephenplusplus
Copy link
Contributor

I'll mark it the issue with "help wanted", so if anyone beats us to implementing it, great!

@stephenplusplus stephenplusplus added the help wanted We'd love to have community involvement on this issue. label Dec 11, 2017
@stephenplusplus
Copy link
Contributor

For now, I think it's best to let the API stand, as-is. If you want to PR it, it should be a non-harmful change, although I don't think there is much demand from the community at this time. We can always re-open if we hear more requests for this.

@ghost ghost removed priority: p2 Moderately-important priority. Fix may not be included in next release. type: enhancement labels Feb 5, 2018
@google-cloud-label-sync google-cloud-label-sync bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Jan 31, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants