aheckmann / gridform

Stream formidable uploads into MongoDB GridFS
http://aheckmann.github.com/gridform/
MIT License
59 stars 17 forks source link

How get file #6

Closed CodersBrothers closed 10 years ago

CodersBrothers commented 11 years ago

When file is saved, how can i get the file?

jperelli commented 10 years ago

I saw some other questions you ask.

Those should be posted on stackoverflow or a similar site, but not here. This repository holds a library to save files in gridfs using formidable. The questions you are asking here are irrelevant to github.

You should create a github issue ONLY when you find a problem with the internals of a library. If you don't know how to solve a particular problem of yours, you shold read carefully the readme.md file, if you don't understand, then read more relevant documentation (nodejs, express, formidable, gridfs). Then, if you don't understand, try to read the code, or suggest a modificaction on the documentation through an issue or a pull request. CONTRIBUTE!

So go there! create an account in stackoverflow, and start asking about solutions for your specific problems there, please!

CodersBrothers commented 10 years ago

I think that only persons that can suggest better docu are the persons that not understand something, for example this library. Its like when UI of APP show that your father can't use your cool design... yeah! but it's cool. LOL.

Anyway, i solved my problem, i understand grid form, and now i can't make questions that help other learning persons... because my mind dont work like a new person.. sorry. Will be good exploit learning persons to make better docu and examples... but you decide...

jperelli commented 10 years ago

Ok, you solved it, and why in the hell didn't you post the solution? Please CONTRIBUTE!

I post a possible solution here, just in case someone (polite) come here looking for the answer through google.

Also in stackoverflow: http://stackoverflow.com/a/18855204/912450

gridfsstream = require('gridform/node_modules/gridfs-stream')
mongoose = require('mongoose')

var conn = mongoose.createConnection(..);
conn.once('open', function () {
  // oid: string representing object id, identifier of a gridfs file
  // res: express response object
  gridfsstream(conn.db, mongoose.mongo).createReadStream(oid).pipe(res);
})