How to read file stored in mongodb gridfs at server side in meteor


#1

Hello All,
I upload a (.json) file to mongodb (gridfs) and I want to read the content of that file in my api at server side in meteor. Is it possible to do so ?

Thanks.


#2

You could take a look at vsivsi:file-collection from atmosphere (meteor add vsivsi:file-collection).


#3

Hello @robfallows,
this package is not working in my app.
Actually I am using ‘fs’ (npm) package at server side for reading file content but it also not working for me and gives the error ‘no such file or directory…’


#4

Hello,
Problem solved. Actually I previously use cfs for inserting file to mongodb, but cfs is deprecated, so I decide to remove cfs from my app and use ostrio:files package for inserting files to mongo. When I insert file in db, then path field is automatically created. Then I pass that path to fs.readFile method and all data of that file is shown. :smiley: