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?
Suspected bug in node-fetch - solved using node-libcurl.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.