https://github.com/grantila/node-stream-status
Reports statistics about a stream as data is passing through it
https://github.com/grantila/node-stream-status
Last synced: 8 months ago
JSON representation
Reports statistics about a stream as data is passing through it
- Host: GitHub
- URL: https://github.com/grantila/node-stream-status
- Owner: grantila
- License: mit
- Created: 2015-09-03T10:18:01.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-21T12:12:30.000Z (almost 10 years ago)
- Last Synced: 2025-02-24T12:07:42.207Z (8 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```js
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);
```