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

244
Vistas
Not able to save Buffer of image into video file in node js

I am trying to capture buffer of images from client application to server side (nodejs) and save it on local machine.

client code -

            var imgStr = new Buffer(img).toString('base64');
            var obj = {};
            obj.image = imgStr;
            socket.emit("screen-capture", JSON.stringify(obj));

server code (nodejs + express)-

       let chunks = []

       socket.on("screen-capture", function (data) {
          data = JSON.parse(data);
          var imgStr = data.image;

          chunks.push(imgStr)

          let buffer = Buffer.from(chunks, 'base64');
console.log('is this a buffer?', buffer instanceof Buffer) // Giving True
           console.log("video size" + buffer.length) // Giving size
           fs.writeFile(`testing.mp4`, buffer, () => console.log('finished downloading video!')); // file saved

    })

But when will open the video file saved it shows empty.

any help is appreciated.

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