Meteor-CollectionFS icon indicating copy to clipboard operation
Meteor-CollectionFS copied to clipboard

Read a file using CollectionFS

Open thibaultlr opened this issue 10 years ago • 2 comments

Hi

I'm using CollectionFS for my file uploads, but I'd like to read the file Content.

I heard about createReadStream/createFileStream but I don't get how it works. PortCollection.find().forEach(function (fileObj) { var readStream = fileObj.createReadStream('thumbs'); console.log(readStream); }

It only shows the file Info but I'd like to see the content, how can I do that ?

Regards

thibaultlr avatar Jul 27 '15 10:07 thibaultlr

any updates on this? i am also wanting to know the same thing

ghost avatar Sep 17 '15 12:09 ghost

I'm using this snippet and it works for me

var filePath, ref, slugs, url;

url =  Images.findOne(imageId).url().split('?')[0];

slugs = url.split('/');

filePath = "/YOUR-SERVER-PATH/" + slugs[3] + "-" + slugs[4] + "-" + slugs[5];

ivan133 avatar Oct 26 '18 15:10 ivan133