https://github.com/revolunet/node-interval-stream
Minimal NodeJS readable stream based on intervals
https://github.com/revolunet/node-interval-stream
delay interval nodejs stream
Last synced: 3 months ago
JSON representation
Minimal NodeJS readable stream based on intervals
- Host: GitHub
- URL: https://github.com/revolunet/node-interval-stream
- Owner: revolunet
- License: mit
- Created: 2015-12-25T23:08:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-18T22:15:29.000Z (almost 8 years ago)
- Last Synced: 2025-03-24T06:58:53.684Z (3 months ago)
- Topics: delay, interval, nodejs, stream
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-interval-stream
   
Minimal NodeJS readable stream based on intervals

## QuickStart
```js
import getIntervalStream from 'node-interval-stream';
var stream = getIntervalStream({
count: 10, // iterations
delay: 250 // ms
});stream.on('data', data => {
console.log(data);
}).on('end', () => {
console.log('finished');
});
```## Tests
```
should receive 0 events in 0ms✔ duration should be 0 < d < 250 and is 106
✔ should have 0 entriesshould receive 1 events in 100ms
✔ duration should be 100 < d < 250 and is 211
✔ should have 1 entriesshould receive 1 events in 10ms
✔ duration should be 10 < d < 250 and is 22
✔ should have 1 entriesshould receive 10 events in 1000ms
✔ duration should be 1000 < d < 1400 and is 1123
✔ should have 10 entriesshould receive 10 events in 100ms
✔ duration should be 100 < d < 400 and is 126
✔ should have 10 entriestotal: 10
passing: 10
duration: 2.4s```
## Author
Julien Bouquillon http://github.com/revolunet
## License
- **MIT** : http://opensource.org/licenses/MIT