I'm a new NodeJS and JS user. For my Web API project, I'm utilising NodeJS. My project, which makes use of the opensubtitles API. The Opensubtitles API returns a URL for a.*gz file. I'd like to save this URL's file to a local folder. I tried a couple other approaches. I was not, however, successful. I saved the file locally, however some of the language characters were corrupted.
Sample file Url:
https://dl.opensubtitles.org/en/download/src-api/vrf-19ed0c61/filead/1954767944.gz
If I download it with a web browser, the characters are coming out properly.
My sample code:
const out = fs.createWriteStream('out.srt');
request(subtitle.getSubDownloadLink()).pipe(zlib.createGunzip()).pipe(out);