f3r:download-collection-csv 0.0.9

Export a collection to csv

Platform: Meteor

Language: JavaScript

Repository: https://github.com/f3r/meteor-export-csv

View on registry: https://atmospherejs.com/f3r/download-collection-csv

Install: meteor add f3r:download-collection-csv@=0.0.9


export-csv

Meteor export mongo collection to csv

Meteor methods server side

download: function() {
  var collection = CollectionToExtract.find().fetch();
  var heading = true; // Optional, defaults to true
  var delimiter = ";" // Optional, defaults to ",";
  return exportcsv.exportToCSV(collection, heading, delimiter);
}

JavaScript file, client side

//events
'click #buttonDownload': function(event) {
  var nameFile = 'fileDownloaded.csv';
  Meteor.call('download', function(err, fileContent) {
    if(fileContent){
      var blob = new Blob([fileContent], {type: "text/plain;charset=utf-8"});
      saveAs(blob, nameFile);
    }
  });

Known issues

  • Documents need to have an identical length of elements.
  • Objects are not displayed (export JSON instead).
Sustain

Releases

0.0.9 December 12, 2016

Project Statistics

SourceRank 6
Dependent repositories 0
Total releases 1
Latest release
First release
Stars 1
Forks 0
Watchers 0
Contributors 4
Repo Size: 14.6 KB

Top Contributors See all

Luis Krister Viirsaar Fer Martin Adam Brown

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2016-12-21 08:08:55 UTC

Login to resync this project