title: generating and serving static files with Meteor
body: <p>I'm looking to create static text files based upon the content of a supplied object, which can then be downloaded by the user. Here's what I was planning on doing:</p>
  
  <ol>
  <li><p>When the user hits 'export' the application calls a <code>Meteor.method()</code> which, in turn, parses and writes the file to the public directory using typical Node methods. </p></li>
  <li><p>Once the file is created, in the callback from <code>Meteor.method()</code> I provide a link to the generated file. For example, 'public/userId/file.txt'. The user can then choose to download the file at that link. </p></li>
  <li><p>I then use Meteor's <code>Connect modele</code> (which it uses internally) to route any requests to the above URL to the file itself. I could do some permissions checking based on the userId and the logged in state of the user.</p></li>
  </ol>
  
  <p>The problem: When static files are generated in public, the web page automatically reloads each time. I thought that it might make more sense to use something like Express to generate a REST endpoint, which could deal with creating the files. But then I'm not sure how to deal with permissions if I don't have access to the Meteor session data.</p>
  
  <p>Any ideas on the best strategy here?</p>