So I've successfully downloaded my image file to my MongoDB using Multer and Multer-Gridfs-Storage, but I'm having trouble retrieving it.
When I tried to retrieve the data using GridFS-Stream, it came back like this previous question: GridFS : How to display the result of readstream.pipe(res) in an <img/> tag?
When I use this code, what's sent to my Front-End is only the first chunk in the collection, but it's actually usable.
const readstream = gfs.createReadStream({ filename: files[0].filename });
readstream.on('data', (chunk) => {
res.send({ image: chunk.toString('base64') })
})
How am I able to get back all of the chunks? Should I give up and start using GridFSBucket?