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

252
Views
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
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!