Storing data stream from POST request in GridFS, express, mongoDB, node.js
I am trying to figure out how I can post an image directly to GridFS without storing it anywhere on the server as a temporary file first.
I am trying to figure out how I can post an image directly to GridFS without storing it anywhere on the server as a temporary file first.
I am trying to setup a file API in my node.js application. My goal is to be able to write the file stream directly to gridfs, without needing to store the file to disk initially. It seems like my create code is working. I am able to save a file upload to gridfs. The problem is reading the file. When I try to download a saved file via a web browser window, I see that the file contents are wrapped with something like the following:
I am running express 4 using multer, gridfs-stream and mongoose with mongodb and I am attempting to upload a file and stream it to gridfs.