-
Notifications
You must be signed in to change notification settings - Fork 297
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 resolving promise with stream #90
Comments
This wouldn't be possible currently in conjunction with the |
It turns out to be possible after all by pausing the stream during the async step: new Promise(function(resolve, reject) {
request.get('http://affenbits.com/')
.on('response', function(response) {
response.pause();
resolve(response);
});
}).then(function(response) {
response.pipe(process.stdout);
}); |
That's good, you can probably use additional |
A |
+1 |
wip / sample: https://gist.github.com/forivall/6b3f3718b5684e9ea8daa5a4dcd855a6 I'll turn that into a pull request if nobody else is working on this. |
Hi @forivall , a PR would be really awesome! You'll need to add the changes to |
@forivall Thank you for your work. Eagerly awaiting your pull request! |
+1 |
+1 |
+1 |
1 similar comment
+1 |
What's the status of this issue? |
+1 |
2 similar comments
+1 |
+1 |
+1 |
I've made a PR for this feature at request/promise-core#16! npm install request-promise@"botgram/request-promise#feature-pause" |
Hmm, could someone review the PR? It'd be great to have this feature |
+1 |
This seems like it will become one of those viral tweets, soon. +1 |
@ps2goat request module (and i assume this module) has been deprecated no more new features will be added. request/request#3142 |
Request-Promise is not designed to be used with streams. However, Request-Promise could resolve the promise not with the response but with the stream object. Then the user could do some piping further down the promise chain.
See request/request#1990 which gave me the idea.
At community: +1s?
The text was updated successfully, but these errors were encountered: