title: How to create and download a text file in Meteor?
body: <p>How can I create a text file easily in Meteor (Server Side) and download as a .txt file? </p>
  
  <pre><code>// On Server
  if (Meteor.isServer) {
    Meteor.methods({
      'scan-db': function () {
         // scan the DB for corrupted data
         var allEntries = Jobs.find().fetch();
         var report = "";
         for ( let i = 0; i &lt; allEntries.length ; i ++ ) {
           if ( validate(allEntries[i]) == false ) {
             report = report + allEntries[i].entryNumber + " has a problem" + "\n";
           // used \n for line breaks in windows
           }
         return report; // a whole bunch of string
  
    })
  }
  
  
  // On client
  if (Meteor.isClient) {
    Meteor.call("scan-db", function(err, res) {
       if (res) {
          downloadFile(res);
       }
    })
  }
  </code></pre>
  
  <p>I am hoping to be able to download my result as a text file to save. Is there any easy way of doing this? I tried using <code>meteorhacks:picker</code> but apparently the package is not working or <code>Picker</code> returned <code>undefined</code> despite importing it <code>import { Picker } from 'meteor/meteorhacks:picker';</code></p>