Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

625
Vistas
Send ArrayBuffer To NodeJS Express Server

I'm want to upload big file to my localhost server. And because the file size will be big ( 500MB maybe ), so I need to send the data chunk by chunk from client. Then my Nodejs server will keep appending the data to a temp file. Finally, I will change the file format and save it.

The problem is, I don't know how to send & read data properly. This is how I'm doing now, in my server I keep getting {} object.

Client Side:

// Prepare & Start Upload
      const reader = new FileReader();
      reader.addEventListener("load", async () => {

        await fetch('/api/v1/file/upload/',  {
          method: 'POST',
          body:  reader.result
        });
      })

      reader.readAsArrayBuffer( file.slice(0) ); // try to read whole file(small) first

My app setup:

/* Register Middlewares */
  app.use(express.json())
  app.use(express.urlencoded({extended:true}))
  app.use('/api/v1/file/upload', fileUploadRouter)
  app.use(express.static('./views'))
  app.use(appError)

  /* App Start */
  const PORT = process.env.PORT || 3000
  app.listen(PORT, () => console.log('Listening to: localhost:'+PORT))

My route

fileUploadRouter.post('/', async ( req, res, next ) => {

  
  var buffer = req.body

  console.log(buffer)
})

Thank for your help!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda