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

336
Views
Node8.x: Why does it download gz file imcompletely?

I tried this script below using Node8.x.
It worked but the size of the downloaded file was imperfect.
I tried for some time and each downloaded file size was not the same.
Using Node9+ I could download the file successfully.
Could anyone explain what was the cause?

  (async () => {
    const path = require('path')
    await downloadPromise(
      'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz',
      path.join(__dirname, './', 't10k-labels-idx1-ubyte.gz'))
  })()

  function downloadPromise (url, savepath) {
    return new Promise((resolve, reject) => {
      const http = require('http')
      const fs = require('fs')
      const outfile = fs.createWriteStream(savepath)
      http.get(url, (res) => {
        res.pipe(outfile)
        res.on('end', () => {
          outfile.close()
          resolve()
        })
      })
      .on('error', (err) => reject(err))
    })
  }
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!