Cannot open downloaded file
See original GitHub issueHere’s the case:
var supertest = require('supertest');
var fs = require('fs');
var express = require('express');
var app = express();
app.get('/image', function (req, res) {
fs.createReadStream('src/test/expected/igloo.jpg').pipe(res);
})
var request = supertest(app);
request.get('/image')
.end(function(err, res) {
fs.writeFileSync('/tmp/test_superagent', res.text)
console.log('end!', res)
})
I’d like to save the image in my tmp directory. The problem is that I can’t open it. I try different encoding but the result is always the same. Is there anything I miss?
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Can't Open Downloads in Windows 10? Try These ... - MiniTool
When you can't open Downloads folder, perhaps there are some corrupted system files. In Windows, the built-in tool – System File Checker, can...
Read more >[Solved] Can't Open Downloads Folder in Windows 10
The first thing to do when you see a not responding/inaccessible Downloads folder is to run the System File Checker. The purpose of...
Read more >Downloads Folder Not Responding on Windows 10? Fix It Now!
Sometimes, corrupted system files or bad sectors on Windows system drive may cause hard drives, folders, or files inaccessible. Therefore, ...
Read more >Can't open a Google file or folder - Android
If a file won't open, a few things could be wrong: You don't have permission to view the file. You're signed in to...
Read more >Cannot open downloaded files - Microsoft Community
Outdated application, application error, file damage, and permission related issues are a few of the possible reasons why you are experiencing ...
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
not sure but try to add
.buffer()
to your request chain like so:request.get(...).buffer().end(fn)
FYI. Fixed the test and the parser and sent a pull request.