Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Cómo descargar archivos grandes y reanudar la descarga después de la interrupción en Node.js

Escribí una aplicación que descarga archivos zip grandes y los extrae usando request y unzipper . También logré mostrar el progreso de la descarga, pero el requisito es que debe poder reanudar la descarga después de una interrupción (internet se cae o la aplicación se cierra, *por ejemplo, cómo Steam descarga juegos) y no puedo resolverlo, mi el código es algo así

 const getInstallerFile = (installerfileURL, installerfilename, Possition, Directory) => { // Variable to save downloading progress var received_bytes = 0; var total_bytes = 0; percentage = 0; var outStream = fs.createWriteStream(installerfilename); request .get(installerfileURL) .on('error', function (err) { console.log("Download has stopped", err); }) .on('response', function (data) { total_bytes = parseInt(data.headers['content-length']); console.log("download has started") }) .on('data', function (chunk) { //gets percentage after every chunk received_bytes += chunk.length; showDownloadingProgress(received_bytes, total_bytes, Possition); }) .pipe(outStream) outStream.on('finish', function () { console.log("download has completed") //...codeblock for storing local data fs.createReadStream(installerfilename) .pipe(unzipper.Extract({ path: Directory })) .on('finish', function () { console.log("unzipper finished extracting") //deleting the zip after downloading fs.rmSync(installerfilename, { recursive: true, force: true }); }); }) };

¿Es posible reanudar la descarga usando una solicitud o incluso un nodo en general?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!