try using utf16le, which seems to be the format of this file (as you can see from the Content-Type headaer in the response).
On Sun, Mar 11, 2018 at 9:05 AM, Adi Lavi <a...@techsee.me> wrote: > Hi, > I am writing a small module that downloads Google's list of supported > devices as csv, but I get it with a BOM I struggle to remove. > > Here is my code snippet: > > // url = http://storage.googleapis.com/play_public/supported_devices.csv > > downloadFile: function(url, cb) { > unirest.get(url) > .timeout(5000) > .header('Upgrade-Insecure-Requests', '1') > .header('Accept-Encoding', 'gzip, deflate, sdch') > .end(function(response) { > let content = response.body; > > fs.writeFile('google_devices.csv', content, 'utf8', (err) => { > > ... > > return cb(null, url); > > }); > > }); > } > > > file starts with 뿯붿 > > > Tried a few bom-strip libraries, but could not make it work > > Please advise > > -- > Job board: http://jobs.nodejs.org/ > New group rules: https://gist.github.com/othiym23/9886289#file- > moderation-policy-md > Old group rules: https://github.com/joyent/node/wiki/Mailing-List- > Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > To post to this group, send email to nodejs@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/nodejs/29f3dd84-c162-4700-84a5-0602c07946ce%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/29f3dd84-c162-4700-84a5-0602c07946ce%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CADJQ9xL_H2Lz-9ogxQQ%2B%3D-zkfpaY%3D4Up6a2Wn-viFVzhK-O5CA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.