title: Wait for callback of async function in last stream.on('data') event
body: <p>I am using <a href="https://github.com/C2FO/fast-csv" rel="nofollow">fast-csv</a> to iterate over a CSV file using a <code>stream</code>. For each row of the CSV file, I want to create a job in redis, for which I use <a href="https://github.com/Automattic/kue" rel="nofollow">kue</a>. Parsing a row is synchronous function. The whole thing looks like this:</p>
  
  <pre><code>var csvStream = fastCsv(_config.csvOptions)
    .on('data', function(data) {
      var stream = this;
      stream.pause();
  
      var payload = parseRow(data, _config);
      console.log(payload); // the payload is always printed to the console
  
      var job = kue.create('csv-row', {
          payload: payload
        })
        .save(function(err) {
          if (!err) console.log('Enqueued at ' + job.id);
          else console.log('Redis error ' + JSON.stringify(err));
  
          stream.resume();
        });
    })
    .on('end', function() {
      callback(); // this ends my parsing
    });
  </code></pre>
  
  <p>The simple <code>console.log(payload);</code> shows for every row of my CSV file, however the job is not created. I.e., none of the outputs in the callback of <code>save</code> are being printed, and the job is not in my redis.</p>
  
  <p>I assume, because it's the last row of the CSV file, the stream already emits <code>end</code> and so the last <code>kue.create()</code> cannot be executed before the process terminates?</p>
  
  <p>Is there a way to halt the stream's <code>end</code> until kue is done?</p>