Hi I\'m new to nodejs and gridFS I\'m trying to display images stored in gridFS to my html page
Currently, I am using this code.
gfs.exist(options, f
Try the function like below,
function(req,res){
gfs.files.findOne({ filename: req.params.filename }, (err, file) => {
res.contentType(file.contentType);
// Check if image
if (file) {
// Read output to browser
const readstream = gfs.createReadStream(file.filename);
readstream.pipe(res);
} else {
console.log(err);
}
});
};