Questions tagged [gridfs-stream]

gridfs-stream is a node.js module that provides streams for writing to and reading from GridFS on MongoDB.

For more information, visit gridfs-stream's github repository.

160 questions
3
votes
2 answers

node.js upload and download pdf file

Framework: node.js/express.js/busboy/gridfs-stream(mongodb) I am using busboy to upload files and then use gridfs-stream to store files in mongodb gridfs. req.pipe(req.busboy); req.busboy.on('file', function…
user3658423
  • 1,904
  • 5
  • 29
  • 49
3
votes
1 answer

Node.js/Mongodb/GridFS resize images on upload

I am saving uploaded images in Mongodb GridFS with Node.js/Express/gridfs-stream/multyparty using streams. Works fine. Now I would like to "normalize" (resize) images to some standard format before storing to database. I could use gm…
Sax
  • 388
  • 5
  • 15
3
votes
2 answers

MongoError when uploading a file using mongoose, gridfs-stream and multer

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. The express route that does this is defined as: app.post('/uploadfile', function (req, res) { …
KennyE
  • 513
  • 6
  • 15
3
votes
2 answers

How to retrieve image file from Mongo using Sails.JS + GridFS?

I'm currently building web using Sails.js and got stuck in retrieving image file from GridFS. I have successfully uploading the file using skipper-gridfs to my mongo gridfs. I have no idea to display the file in the correct way (I'm new in Sails.js…
2
votes
1 answer

Error: missing db argument when i make Grid(db, mongo)

i use gridfs to store the files in monogodb when i retrive files to database i make the Grid type object but here the error which is missing db argument how to solve this import mongoose from "mongoose"; import Folders from…
2
votes
0 answers

Stuck the the error : Typeerror : grid.mongo.objectID is not a constructor

I was trying to upload images to mongodb database. And Then got this error which I am not able to resolve. Can someone help! The code after all the require statements is show below // MONGOOSE CONNECTION const conn =…
2
votes
1 answer

Can not get files metadata from mongodb as gfs of Gridfs-stream is undefined

I can upload files to mongodb using the standard Gridfs-stream implementation through a POST request. But, when I need to view the file metadata through GET request I'm getting error: TypeError: Cannot read property 'files' of undefined Apparently,…
forest
  • 1,312
  • 3
  • 20
  • 47
2
votes
0 answers

How to integrate mongoose model with Gridfs and associate additional fields like req.body.name and things like description

I am trying to create a photo application that stores images like jpeg and png along with some details like title, description. I following brad traversy's GridFS tutorial I am unable to associate my mongoose model with gridfs code. The code that…
2
votes
1 answer

How can I specify a GridFS bucket when executing find() using gridfs-stream

Using gridfs-stream, how do I specify the bucket name when finding and fetching files? My question is a follow-up to the following question found on stackoverflow at How can I specify a GridFS bucket The solution there provides an example of how to…
Steve B
  • 257
  • 4
  • 13
2
votes
1 answer

Download image file from MongoDB

Trying to download image file from MongoDB using route: router.get('/:id', function(req, res) { gfs.findOne({ _id: mongoose.Types.ObjectId(req.params.id) }, function(err, file) { if (err) { common.handleError(err, res); return; …
emiles
  • 739
  • 1
  • 10
  • 17
2
votes
1 answer

How to read a video with gridfs-stream?

I'm using mongoose with gridfs-stream to store files, images, audios, and videos. The problem is when I select another position/time in the video, is stopped, the same happens when I play any song. Someone can help me? This is my…
2
votes
1 answer

GridFS find file by _id download with the name of the file

I want to post a file in express/mongodb with multer and gridfs. This file gets linked in the frontend with an and if I click on it I want to display the realname of the file though, for example "example.pdf" and not :id.pdf. Right now posting…
FroZenViper
  • 1,051
  • 1
  • 8
  • 11
2
votes
1 answer

Read PDF from mongoDB and display in HTML

So I was successfully able to upload a PDF to mongoDB but reading and displaying it is an issue. I uploaded the pdf and read it by converting like so: var buf2 = new Buffer(data).toString('base64'); The above gave the pdf in the following…
Skywalker
  • 4,984
  • 16
  • 57
  • 122
2
votes
3 answers

Display images from GridFs (MongoDB)

I am using the following code to read the image file saved in MongoDB using GridFs: app.get('/picture', function(req, res) { var readstream = gfs.createReadStream({ filename: 'trooper.jpeg' }); readstream.on('data', function (data) { //…
Skywalker
  • 4,984
  • 16
  • 57
  • 122
2
votes
0 answers

Streaming mp4 videos to Safari

I'm using Sails.js to stream a mp4 file of a GridFS collection to my visitors. Chrome and Firefox are working fine, but Safari does it the Apple way - or in other words - it isn't working there. I only get the message "Failed to load resource". For…
user2891491
  • 351
  • 8
  • 16
1
2
3
10 11