Im not sure if im using promise.all wrong, or if the nodejs package I use for retrieving pdf remotly and parsing these is overwhelmed by too many requests at once.
https://codesandbox.io/s/sharp-wave-qikvb // here the codesandbox
I attempted to use promise.all
let urls = [arrayofURLS];
function pdfData() {
return Promise.all(
urls.map(item => {
this.crawlPdf(item);
})
)
.then(result => {
// handle result
})
}
This is the function that uses the crawler package (called crawler-request) :
crawlPdf: async function(Url) {
return new Promise(async function(resolve, reject) {
let response = await crawler(Url);
resolve(response.text);
}
2 out of 5 requests are usually undefined. But sometimes everything works o.O..