kevva / download

Download and extract files
MIT License
1.28k stars 200 forks source link

GotError [RequestError]: connect ETIMEOUT error to donwload pdf files #221

Open JZ-314 opened 2 years ago

JZ-314 commented 2 years ago

I am downloading pdf files from online ulrs using download module in node.js. But When I download pdf files, that error is showed. How to fix this error?

I used my code like this. pdfArr.forEach(async (url) => { await download(url, pdfDir) .then(() => { console.log(pdfArr.length, index); if (index === pdfArr.length - 1) { return res.status(200).json({ success: true, data: index }); } index++; }); });

error:

GotError [RequestError]: connect ETIMEDOUT 170.131.2.12:80 at ClientRequest. (C:\project\node_modules\got\index.js:182:22) at Object.onceWrapper (node:events:510:26) at ClientRequest.emit (node:events:390:28) at Socket.socketErrorListener (node:_http_client:447:9) at Socket.emit (node:events:390:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'ETIMEDOUT', host: 'host.com', hostname: 'host.com', method: 'GET', path: '/pdf/642736.pdf', protocol: 'http:', url: 'http://pdf/642736.pdf' }