How to convert a base64 encoded string into a ReadableStream?

Viewed 288

I'm using a library to upload a file and the documentation says this:

channel.sendImage( 
        fs.createReadStream('./helloworld.jpg'), 
        'hello_world1.jpg'
)

I don't have a file though, nor am I interested in creating a file, then deleting the file after this function call.

I have a base64-encoded string that I get from another 3rd-party service and I want to pass the base64-encoded string into this function.

The function sendImage takes in a NodeJS.ReadableStream.

0 Answers
Related