Downloading binary data
See original GitHub issueCould you please document somewhere the function at https://github.com/visionmedia/superagent/blob/054782dfaa3f0fd360411be0cbd0f8319d8a75b9/lib/node/index.js#L346? It is tremendously useful if you just want to download binary data. You can use it like this:
var stream = fs.createWriteStream('path/to/my/file.zip');
request.get('http://example.com/file.zip').pipe(stream);
Note: IT does NOT work if you use the Reponse#pipe()
method. That method only produces garbage.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Android Uploading and Downloading Binary Data
Android Uploading and Downloading Binary Data. You can upload and download binary data to the GameSparks platform in two ways: Manually; From the...
Read more >Uploading and Download Binary Data - Juniper Networks
Uploading and Downloading Binary Data. This topic explains how to test REST APIs that upload and download binary data using the SDK REST...
Read more >Downloading binary files - Thomas Levine
Downloading binary files. Binary files might seem scary if you're used to looking at text. They might be even scarier if they're floating...
Read more >Android How to - Download Binary Data from the web
The following code shows how to Download Binary Data from the web. Example. Add the following statement to the AndroidManifest.xml file: <?xml version="1.0" ......
Read more >Download Binary Data with different types - OutSystems
Download Binary Data with different types ... I have a binary list for my web application, and I want to download the file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your reply @kornelski Yesterday I lost all my afternoon trying to trigger the error event on the pipe, forcing a 401 on my request, so I can say with a very high degree of confidence that the event it’s either not being fired by the request error, or it’s not working.
You can’t directly. You have to call either
.pipe()
or.then/.end()
first to make the request.There’s
response
event which lets you inspect the headers as soon as they arrive. Then you can unpipe?Also with the pipe you should get
error
event on the pipe.