I have base64 image string in my backend and now I want to use https://github.com/nkzawa/socket.io-stream#sscreateblobreadstreamblob-options which uses File or Blob, how can made Blob in Nodejs ?
1 Answer
In Node.js you don't have Blobs but Buffers. You can create a buffer from a base64 string like this:
var str = "iAAANS....SUVORK5CYII="; // <-- use real base64 string here
var buf = Buffer.from(str, "base64");
stream.write(buf);
    4 Comments
Narek Mamikonyan
 Thanks Marc for answer , but the link which I've posted the documentations said "Create a new readable stream for Blob and File on browser." , will it work with Buffer ?
  Marc
 What do you want to achieve? Do you want to send the image from the backend to the browser? Maybe you can show some code you are trying to get running?
  Narek Mamikonyan
 I must send to socket BlobStrem , from my node server, and in my node server I have base64 image , how can I convert it to BlobStream ?
  Marc
 As far as I can see BlobStream ist just for the browser side (where you have Blobs). On the server side use 
  var stream = ss.createStream(); stream.write(buffer);