I'm downloading a repo's zip file like so:
var fs = require("fs");
var got = require("got");
got("https://codeload.github.com/sindresorhus/got/zip/master")
.then(res => {
fs.writeFileSync("master.zip", res.body);
}).catch(err => {
console.error(err);
});
It produces a master.zip archive that is seemingly corrupt and not openable. :disappointed:
But it works via curl:
$ curl 'https://codeload.github.com/sindresorhus/got/zip/master' -o master.zip
Any ideas?
Pass encoding: null in options to get raw Buffer from got.
Thanks. :smile:
Is this still the case? This says Don't set this option to null
Most helpful comment
Pass
encoding: nullin options to get raw Buffer fromgot.