Skip to content

Instantly share code, notes, and snippets.

@natpen
Created July 29, 2015 18:58
Show Gist options
  • Select an option

  • Save natpen/eb8f36635a75f2e9bf8f to your computer and use it in GitHub Desktop.

Select an option

Save natpen/eb8f36635a75f2e9bf8f to your computer and use it in GitHub Desktop.

Revisions

  1. natpen created this gist Jul 29, 2015.
    27 changes: 27 additions & 0 deletions nodeStreamConfusion2.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    var spawn = require('child_process').spawn;
    var csv = require('csv');

    var ls = spawn('git', ['log']);

    ls.on('close', function (code) {
    console.log('exit code ' + code);
    });

    var parser = csv.parse({ delimiter: '\t' });
    parser.on('data', function(data) {
    setTimeout(function() {
    console.log('data');
    }, 30);
    });

    parser.on('end', function() {
    console.log('parser end');
    });

    parser.on('finish', function() {
    console.log('parser finish');
    });



    ls.stdout.pipe(parser);