CollectionFS: storeBuffer is not a function


#1

Hi,

I want to make a download button which allows the user to download a csv file.
I am trying to achieve this using CollectionFS:

When the user clicks a button, a Meteor method is called, with the following code:

 var csv = 'Hello world';
 var buffer = Buffer(csv.length);
 var filename = "text.csv";
 for (var i = 0; i < csv.length; i++) {
    buffer[i] = csv.charCodeAt(i);
 }
 var ReportsFS = new FS.Collection('reportsFS', {stores: [new FS.Store.FileSystem("reports", {path: "~/reports"})]});
 ReportsFS.storeBuffer(filename, buffer, {
      contentType: 'text/plain'
 });

I keep on getting the same error: ReportsFS.storeBuffer is not a function

What am I missing?

Thanks for your help!