I'm using gridform to save a file in gridfs, how can I get the file to return it to a user?
Asked
Active
Viewed 114 times
1 Answers
0
Possible solution, looking documentation here
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); })

jperelli
- 6,988
- 5
- 50
- 85