Gridfs openUploadStream from buffer

hello. below i try to open a GridFS upload stream to upload an image. the image is received from client as base64 and then converted to buffer. i want to store it in gridfs (to retrieve as an image later)
`const bucket = new mongodb.GridFSBucket(database, { bucketName: ‘myImageBucket’ });
const buffer = new Buffer.from(req.body.file, ‘base64’);
const readable = Readable.from(buffer);
readable._read = () => {}

                    chunkSizeBytes: 1048576,
                    metadata: { 
                        field: 'from just-mern-app', value: "myValue",
        on("finish", function (file) {
            console.log(file, "finished");process.exit(0);
        on("error", function (e) {
            console.log("err is: ", e);
    await client.close();
    return res.send("file uploaded by GridFS");
} catch (error) {
    console.log("Error in GridFS connection: ", error);
    return ;


the above code doesn’t work because (assuming everything else is correct) openUploadStream accepts file path, while I want to provide it only with buffers, how can i implement it?