title: processing highland stream chunks using async
body: <p>I'm using <code>highland.js</code> to process a file using a stream to read the contents between two delimiters. I'm also using <code>async.js</code> to run a series of http requests in sequence. </p>
  
  <p>Ideally I would like to pass the output <code>x</code> from highland as the first function to the <code>async</code> series (chain) so that the HTTP requests get executed for each chunk extracted from the stream.</p>
  
  <p>Is this possible? If so, how can this be achieved?</p>
  
  <pre><code>var async = require('async');
  var _ = require('highland');
  
  
  _(fs.createReadStream(files[0], { encoding: 'utf8' }))
          .splitBy('-----BEGIN-----\n')
          .splitBy('\n-----END-----\n')
          .filter(chunk =&gt; chunk !== '')
          .each(function (x) {
          }).done(function () {
  
      async.series([
          function(callback) {
              setTimeout(function() {
                  console.log('Task 1');
                  callback(null, 1);
              }, 300);
          },
          function(callback) {
              setTimeout(function() {
                  console.log('Task 2');
                  callback(null, 2);
              }, 200);
          },
      ], function(error, results) {
          console.log(results);
      });
  
  });;
  </code></pre>