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

Pipe GET Request data to POST request #3

Open
goergch opened this issue Jul 10, 2018 · 0 comments
Open

Pipe GET Request data to POST request #3

goergch opened this issue Jul 10, 2018 · 0 comments
Assignees

Comments

@goergch
Copy link
Member

goergch commented Jul 10, 2018

https://github.com/request/request#requestoptions-callback

You can stream any response to a file stream.

request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case application/json) and use the proper content-type in the PUT request (if the headers don’t already provide one).

@goergch goergch self-assigned this Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants