How could I display a non-image file stored in MongoDB(using GridFS) on a web page?

99 Views Asked by At

I am working on a site that allows a user to upload a document (not an image), which is then stored in MongoDB with GridFS. My question is... is it possible to then embed/display that document for viewing on the site? Everytime I use the createReadStream method, it just downloads the document. I would like it to show the actual document or the document's contents on the webpage, possibly in an iframe. Maybe there is a way to make a url for the document, or access the file another way? Thanks in advance.

1

There are 1 best solutions below

1
On
<ifram

 <iframe src= 'https://www.vanmeegern.de/fileadmin/user_upload/PDF/Web_Development_with_Node_Express.pdf' frameborder="0" width="400px" height="600px"></iframe>

e>