Skip to content

grantila/node-stream-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stream-status

Reports status about data flowing through a stream, namely the number of chunks and bytes passing through.

The given callback will be called every n milliseconds (defaults to 1000, i.e. every second) with the arguments (bytes, chunks, false), and when the stream ends with the arguments (bytes, chunks, true).

Example:

var streamStatus = require('stream-status');

function reporter(bytes, chunks, hasEnded) {
  if (hasEnded)
    console.log("The stream finished with " + bytes + " bytes in " + chunks + " chunks.");
  else
    console.log(bytes + " bytes has passed through in " + chunks + " chunks");
}

inStream.pipe(streamStatus(reporter)).pipe(outStream);

About

Reports statistics about a stream as data is passing through it

Resources

License

Stars

Watchers

Forks

Packages

No packages published