tap-stream
Taps a nodejs stream and logs the data that's coming through.
Last updated 7 years ago by thlorenz .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tap-stream 
SYNC missed versions from official npm registry.

tap-stream

Taps a nodejs stream and prints the data that's coming through.

Detail of printed objects can be controlled via the depth parameter.

For even more control a custom log function be supplied

function objectStream () {
  var s = new Stream()
    , objects = 0;
 
  var iv = setInterval(
      function () {
        s.emit('data', { 
            id: objects
          , created: new Date()
          , nest: { 
                name: 'yellow rumped warbler'
              , age: 1
              , egg: { name: 'unknown' , age: 0 }
              } 
          }
        , 4
        );

        if (++objects === 2) {
            s.emit('end');
            clearInterval(iv);
        }
      }
    , 200);
  return s;
}

objectStream().pipe(tap(0));:

depth0

objectStream().pipe(tap(1));:

depth1

objectStream().pipe(tap(2));:

depth2

Current Tags

  • 0.2.0                                ...           latest (7 years ago)

4 Versions

  • 0.2.0                                ...           7 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
  • 0.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |