gridfs

MongoDB as file storage

旧城冷巷雨未停 提交于 2019-11-27 11:48:36
问题 i'm trying to find the best solution to create scalable storage for big files. File size can vary from 1-2 megabytes and up to 500-600 gigabytes. I have found some information about Hadoop and it's HDFS, but it looks a little bit complicated, because i don't need any Map/Reduce jobs and many other features. Now i'm thinking to use MongoDB and it's GridFS as file storage solution. And now the questions: What will happen with gridfs when i try to write few files concurrently. Will there be any

Storing data stream from POST request in GridFS, express, mongoDB, node.js

点点圈 提交于 2019-11-27 07:18:26
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: req.pipe(fs.createWriteStream('./test.png')); I am also able to store directly to GridFS from a readStream when the readStream is created from a file on the server. (see code) I have the following files, saveFromReq.js which listens for the POST and basically just passes this on to the savePic.js . saveFromReq.js: var express = require('express'); var app =

Changing a buffer from a ReadStream into an actual file

大兔子大兔子 提交于 2019-11-27 05:33:30
So I have this code: downloadFile(file_id) { return new Promise((resolve, reject) => { var mongoose = require('mongoose'); var Grid = require('gridfs-stream'); var fs = require('fs'); mongoose.connect(config.db, {useNewUrlParser: true},).catch(e => console.log(e)); var conn = mongoose.connection; Grid.mongo = mongoose.mongo; var gfs = Grid(conn.db); console.log('downloadfile', file_id); var read_stream = gfs.createReadStream({_id: file_id}); let file = []; read_stream.on('data', function (chunk) { file.push(chunk); }); read_stream.on('error', e => { console.log(e); reject(e); }); return read

Storing some small (under 1MB) files with MongoDB in NodeJS WITHOUT GridFS

怎甘沉沦 提交于 2019-11-27 00:59:52
问题 I run a website that runs on a backend of nodeJS + mongoDB. Right now, I'm implementing a system to store some icons (small image files) that will need to be in the database. From my understanding, it makes more sense NOT to use GridFS, since that seems to be tailored for either large files or large numbers of files. Since every file that I need to save will be well under the BSON maximum file size, I should be able to save them directly into a regular document. I have 2 questions: 1) Is my

Meteor: uploading file from client to Mongo collection vs file system vs GridFS

落花浮王杯 提交于 2019-11-26 18:51:08
问题 Meteor is great but it lacks native supports for traditional file uploading. There are several options to handle file uploading: From the client , data can be sent using: Meteor.call('saveFile',data) or collection.insert({file:data}) 'POST' form or HTTP.call('POST') In the server , the file can be saved to: a mongodb file collection by collection.insert({file:data}) file system in /path/to/dir mongodb GridFS What are the pros and cons for these methods and how best to implement them? I am

MongoDB GridFs with C#, how to store files such as images?

百般思念 提交于 2019-11-26 18:16:45
I'm developing a web app with mongodb as my back-end. I'd like to have users upload pictures to their profiles like a linked-in profile pic. I'm using an aspx page with MVC2 and I read that GridFs library is used to store large file types as binaries. I've looked everywhere for clues as how this is done, but mongodb doesn't have any documentation for C# api or GridFs C#. I'm baffled and confused, could really use another set of brains. Anyone one know how to actually implement a file upload controller that stores an image uploaded by a user into a mongodb collection? Thanks a million! I've

HTML5 video will not loop

∥☆過路亽.° 提交于 2019-11-26 15:48:00
I have a video as a background to a web page, and I am trying to get it to loop. Here is the code: <video autoplay='true' loop='true' muted='true'> <source src='/admin/wallpapers/linked/4ebc66e899727777b400003c' type='video/mp4'></source> </video> Even though I have told the video to loop, it does not. I also tried to get it to loop with the onended attribute (as per this Mozilla support thread , I also tried that bit of jQuery). Nothing has worked so far. Is it an issue with Chrome, or my code? Edit: I checked the Network events and HEAD of a working copy ( http://fhsclock-labs.heroku.com/no

Storing data stream from POST request in GridFS, express, mongoDB, node.js

北城以北 提交于 2019-11-26 13:07:54
问题 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: req.pipe(fs.createWriteStream(\'./test.png\')); I am also able to store directly to GridFS from a readStream when the readStream is created from a file on the server. (see code) I have the following files, saveFromReq.js which listens for the POST and basically

Changing a buffer from a ReadStream into an actual file

倾然丶 夕夏残阳落幕 提交于 2019-11-26 11:37:24
问题 So I have this code: downloadFile(file_id) { return new Promise((resolve, reject) => { var mongoose = require(\'mongoose\'); var Grid = require(\'gridfs-stream\'); var fs = require(\'fs\'); mongoose.connect(config.db, {useNewUrlParser: true},).catch(e => console.log(e)); var conn = mongoose.connection; Grid.mongo = mongoose.mongo; var gfs = Grid(conn.db); console.log(\'downloadfile\', file_id); var read_stream = gfs.createReadStream({_id: file_id}); let file = []; read_stream.on(\'data\',

Is GridFS fast and reliable enough for production?

我的梦境 提交于 2019-11-26 10:08:15
问题 I develop a new website and I want to use GridFS as storage for all user uploads, because it offers a lot of advantages compared to a normal filesystem storage. Benchmarks with GridFS served by nginx indicate, that it\'s not as fast as a normal filesystem served by nginx. Benchmark with nginx Is anyone out there, who uses GridFS already in a production environment, or would use it for a new project? 回答1: I use gridfs at work on one of our servers which is part of a price-comparing website