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
18
votes
5 answers

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 using Postman (chrome ext.) to post a file, and I manage to store this post as a file using:…
eirik
  • 407
  • 1
  • 4
  • 9
12
votes
3 answers

how to replace gridStore to gridFSBucket?

I have this error message: (node:11976) DeprecationWarning: GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead and sometimes I have trouble viewing the picture , I guess because of that, due to poor…
Alexander
  • 1,288
  • 5
  • 19
  • 38
8
votes
2 answers

Node.js File Upload (Express 4, MongoDB, GridFS, GridFS-Stream)

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…
Devon Sams
  • 1,324
  • 2
  • 12
  • 19
6
votes
1 answer

GridFS + NodeJS Retrieve image from mongoDB

I have the following JSON from mongoDB with images but I don't know how to display it: fs.chunks: { "_id" : ObjectId("542e684a8a1cec178a172673"), "n" : 1, "data" :…
Jose
  • 1,159
  • 1
  • 9
  • 23
5
votes
1 answer

gridfs-stream always stores files with "contentType: binary/octet-stream"

I am trying to code a program in nodejs that stores a list of files in mongodb. It works OK, but there is a problem: it always stores the contentType metadata as binary/octet-stream, and I would like it to store the actual mime-type. I have tried…
4
votes
0 answers

Mongoose gridfs-stream grid.mongo.ObjectID is not a constructor at new GridWriteStream

I'm trying to have a play with gridfs-stream but I'm having issues posting an image file to my upload controller. When it tried to create the write stream is returns grid.mongo.ObjectID is not a constructor at new GridWriteStream I've searched…
geolaw
  • 412
  • 1
  • 12
  • 26
4
votes
1 answer

How to send an retrieved image from Mongo using GridFS in Spring Rest Call?

I have retrieved the image from Mongo DB using Spring Data and GridFs Template so i don't know how to serve that retrieved input stream back to user . Say they requested for the http://host.com/apple as a spring rest call . Now my application…
ajayramesh
  • 3,576
  • 8
  • 50
  • 75
3
votes
1 answer

Can't stream video from MongoDB using GridFS

I am trying for quite some time to stream a video from MongoDB. Read tons of api DOCs and examples just can't get it to work This is my front-end video Handler : import { useState, useEffect } from "react"; import ReactPlayer from…
Oyosied
  • 43
  • 7
3
votes
0 answers

Error: The database connection must be open to store files - Error while uploading file using GridFSStorage

I am using node server to upload document as blob into the mongodb database. I started the connection using mongoose on node server starting itself. But I got below error while calling upload API. Error: The database connection must be open to store…
3
votes
1 answer

How to insert a file, server-side, into images, fs.files and fs.chunks -GridFS (Ostrio/files)

I am using Ostrio/files also known as meteor-files (from VeliovGroup or keenethics) on the server-side to insert a file to db.images, db.fs.files and db.fs.chunks. My code only manages to insert a record only in db.images and nothing on fs.files and…
yusha uzumo
  • 211
  • 1
  • 4
  • 15
3
votes
0 answers

Store file with Mongoose/GridFS with FeathersJs

Building a REST API with FeathersJS I need to be able to upload a picture (POST), record if thanks to GridFS and be able GET it later. I start set up GridFS with Mongoose: const mongoose = require('mongoose'); const Grid =…
Ragnar
  • 2,550
  • 6
  • 36
  • 70
3
votes
1 answer

How to remove a file from both chunks and files in GridFS?

Mongoose var Grid = require('gridfs-stream'); var mongoose = require('mongoose'); var GridFS = Grid(mongoose.connection.db, mongoose.mongo); GridFS.collection('backupdata').remove({_id: mongoose.Types.ObjectId(req.file_id)}, function (err) { …
Naveen
  • 757
  • 3
  • 17
  • 41
3
votes
0 answers

How to send response in Node Express with file and data

module.exports.validateUser = function (req, res) { User.find({ 'username': req.body.username, 'password': req.body.password }, function (err, result) { if (result.length) { var gridfs = req.app.get('gridfs'); var readstream =…
Shreyas
  • 1,927
  • 17
  • 34
3
votes
1 answer

Reading and Displaying images from mongoDB using GridFs

I have been able to successfully upload images to mongoDB using GridFs. Below are images from my database: fs.files: fs.chunks: Below is the code I used to upload images: var Grid = require('gridfs-stream'); var mongoose =…
Skywalker
  • 4,984
  • 16
  • 57
  • 122
3
votes
0 answers

Express file upload with multer and gridfs (corrupted file ?)

I'm trying to upload a file (an image), the upload is fine, the file is stored in Mongo and have the same content type and same size as the original file, then when I try to download it, the file is corrupted but keeps the same content type (if I…
Yanis26
  • 247
  • 2
  • 13
1
2 3
10 11