title: Piping data from a file to a rendered page in Sails.js
body: <p>My application needs to read in a large dataset and pipe it to the client to manipulate with D3.js. The problem is, on large datasets, the reading/loading of the file contents could take a while. I want to solve this using streams. However, I'm unsure of how to do so in the context of the Sails framework.</p>
  
  <p>What I want to do is read the contents of the file and pipe it to a rendered page. However, I can't figure out how to pipe it through if I use something like <code>res.view('somePage', { data: thePipedData });</code>. </p>
  
  <p>I currently have something like this:</p>
  
  <pre><code>var datastream = fs.createReadStream(path.resolve(DATASET_EXTRACT_PATH, datatype, dataset, dataset + '.csv'));
  datastream.pipe(res); 
  ...
  return res.view('analytics', { title: 'Analytics', data: ??? });
  </code></pre>
  
  <p>What's the best way to approach this?</p>