Im trying to download a json response from an API and it fails like 9 out of 10 times.
The response is quite large - roughly 90mb. Downloading in postman, webbrowser works every time, but in node the response seems to be distorted and not a valid json. Sometimes it works.
Tried both v16.1.0 and v14.15.5 using node-fetch-2.6.1
const fetch = require('node-fetch');
fetch('https://xxxxx', {
headers: { 'Authorization': 'Basic xxxxxx',
},
})
.then(res => res.json())
.then(json => console.log(json));
Any ideas?