Why nodejs breaks data downloading and saving the file?

The goal is to get Buffer data, but when downloading data it contains curves, if you save the file, the file contains rubbish instead of a picture.
What's the problem? node v4.3.1 the full Code:
var request = require('request');
var fs = require('fs');

var url = 'http://codewinds.com/assets/codewinds/codewinds-podcast-200.png';
console.log('START', url);

request.get(url, function (error, response, body) {
 if (!error && response.statusCode == 200) {
 console.log('LENGTH', body.length);

 fs.writeFile("11111.png", body, function(err) {
 if(err) {
 return console.log(err);
}
});
};
});
July 12th 19 at 16:35
2 answers
July 12th 19 at 16:37
Solution
Do we need to reset the character set: defaults({encoding: null})
otherwise, it is a picture in utf8 encode %-\
July 12th 19 at 16:39
Maybe
fs.writeFile("11111.png", body, 'binary', function(err) {
 if(err) {
 return console.log(err);
}
 });
no did not help, the original file size is 13376 b binary out ~24kb, opens with binary 12940 b
body.length shows 12940, ie seeing the file is not completely downloaded. - oceane59 commented on July 12th 19 at 16:42
*apparently - oceane59 commented on July 12th 19 at 16:45

Find more questions by tags Node.js