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
0
votes
1 answer

Gridfs and mongoose file upload

I have ran into a problem with gridfs file upload. Basically I get this bizzare error and I have yet not found solution for solving this problem. Here is my code that should deal with file upload: var path = require('path'); var router =…
Oskar Martin
  • 73
  • 2
  • 12
0
votes
1 answer

Gridfs delete file error

I'm using mongoose and mongoose-gridfs module and can't figure out how to fix error. Can easily add file to my db and read it: router.get('/:id', (req, res)=> { if (gridfs == null) { gridfs = require("mongoose-gridfs")({ …
Mongoname
  • 65
  • 9
0
votes
0 answers

How to return in client side large base64 image with GridFS?

I store images with GridFS on MongoDB and I want to display this images on the client side. The code works for little image, but when I want to display images bigger than 5 Mo, I have no return in client side. ResultController.js…
Pouchopa
  • 253
  • 1
  • 3
  • 11
0
votes
1 answer

Node res.write all data before res.end() is called

Trying to write all files and then end response, but it somehow calls res.end before all writing is finished. How I can fix it, to do all the writing, and after that call res.end()? Error msg atm: Error: write after end app.get('/api/upload',…
edu
  • 53
  • 7
0
votes
0 answers

Send multiple files from Mongodb to view with gridFs

Code can send one image file to view, but when I want to send many files, it gives error: Error: Can't set headers after they are sent. app.get('/api/upload', function (req, res) { var arr = []; var i =0; gfs.files.find({}, {}).forEach(function…
edu
  • 53
  • 7
0
votes
1 answer

How to delete documents from fs.chunks in mongoDB using GRIDFS

var GridFS = Grid(mongoose.connection.db, mongoose.mongo); GridFS.remove({_id: mongoose.Types.ObjectId(req.params.file_id)}, function (err) { if (!err) { return res.send(204); } else { console.log("error"); } }); using…
Naveen
  • 757
  • 3
  • 17
  • 41
0
votes
0 answers

MongoDB/ Mongoose - how to extend data storage with with GridFS?

How can I use GridFS to store data? I have stored data content in a document as follows: Schema: var mongoose = require("mongoose"); var mongoosePaginate = require('mongoose-paginate'); // Declare schema var streadatamSchema = new…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
1 answer

How to display all images from gridfs

I was thinking there should be an fs.files.findAll() so I could get all the file names and display it on the page. right now I could only find one at I time and I could display them. I want to have an index page with all the images in the DB. const…
jack blank
  • 5,073
  • 7
  • 41
  • 73
0
votes
1 answer

MongoDb and GridFS - Any Virus Risk from File Uploads?

If you allow web users to upload documents to Mongo with GridFS, is there any risk of infecting your network with a virus? Let's assume the Mongo instance is isolated, so no user can access it and download the files. Then the files will be virus…
javatestcase
  • 682
  • 1
  • 10
  • 25
0
votes
2 answers

GRIDFS mp3 Collection with meteor

I am new to meteor and I am trying to define an mp3 collection and then upload music to it from the admin page. I have these packages installed: cfs:standard-packages cfs:gridfs cfs:filesystem 1) I have defined the collection both on the client and…
az6bcn
  • 339
  • 3
  • 19
0
votes
1 answer

why cant i write a second file to gridfs without refreshing template view in a MEAN app?

I am having a problem writing a second audio file to gridfs. I am using ng-file-upload to pick a file, pass the file/binary data to gridfs, and write it to the database. The first file works fine, however unless i load a different view first, then…
Chris Wilson
  • 135
  • 3
  • 16
0
votes
1 answer

Are there cons to using GridFS as a default with MongoDB?

I'm creating a RESTful API with node, express, and mongodb and the book I'm using as a reference recommends using GridFS (namely gridfs-stream) for cases where one needs to handle files larger than the MongoDB cut-off (16MB) I'm not sure if my app…
Tom Sitter
  • 1,082
  • 1
  • 10
  • 23
0
votes
1 answer

How to send and retrieve two MIME types as responses from node.js to html for one get call

My js code : http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write("sending two files"+" "); res.writeHead(200, {'Content-Type', "video/mp4"}); var stream = GridFile.stream(true); …
dev777
  • 999
  • 6
  • 17
  • 34
0
votes
1 answer

saving video/images to MongoDB in NodeJS server by using GridFS

I am looking for a sample example for storing videos/images in MongoDB using GridFS. I came across this official site and followed the below code snippet var MongoClient = require('mongodb').MongoClient, Grid = mongo.Grid; // Connect to the…
Rahul Matte
  • 1,151
  • 2
  • 23
  • 54
0
votes
1 answer

nodeJS file upload using request library

I am trying to upload a file to a server (built using Java) by reading from a mongodb gridfs stream. exports.upload = function(req, res, next) { var IHUrl = config.api.url + "PhotosServlet"; var data = req.body; var file1 =…
Prabhat
  • 4,066
  • 4
  • 34
  • 41