NODE.JS - How to decode Base64 encoded string to video file?

1k views Asked by At

I am trying to decode base64 encoded string to video or image based on the type.

fs.writeFile(attachment_path, new Buffer(encodedString, "base64"), function(err) {
            if(err)
            {
              return callback(err);
            }
            callback(null, 'perform_create');
          });

It does not give any error and creates a file. The image files work fine but when I play a video file it gives an error Could not determine type of stream. Can anyone tell me what am I missing here?

0

There are 0 answers