util-pipe

Pipe streams and handle events

Util Pipe [DEPRECATED] use pipe-io

Easy way to create pipe which would handle all error events and redirect tham to callback.

    var pipe        = require('util-pipe'),
        NameFrom    = 'README.md',
        NameTo      = 'README_COPY.gz',
        
        options     = {
            gzip: true
        };
    
    pipe.create(NameFrom, NameTo, options, function(error) {
        var msg = 'done';
        
        console.log(error || msg);
    });

Get body of readStream

    var pipe        = require('util-pipe'),
        fs          = require('fs'),
        NAME        = 'README.md',
        readStream  = fs.createReadStream(NAME);
    
    pipe.getBody(readStream, function(errordata) {
        console.log(error || data);
    });