A sporadically choking stream; burp this baby!
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
README.md
example.js
package.json

README.md

Hiccup build status

Create streams that simulate slow, sloth-like behavior

Example

var stream = require("stream"),
    hiccup = require("hiccup");

// create slow stream; emits ~3 bytes every ~200 ms
var weezing = new hiccup.Throttle({bytes: 3, latency: 200});

// create a choking stream; lags for 1 s every 2 s
var koffing = new hiccup.Choke({delay: 1000, interval: 2000});

// connect streams
weezing.pipe(koffing).pipe(process.stdout);

// the weezing daydreams about meat!
weezing.write("Spare ribs ribeye pancetta meatball ham hock tongue fatback \
drumstick tenderloin. Cow ribeye turducken, pancetta short loin shoulder \
pork belly venison biltong. Capicola ball tip venison kielbasa cow \
hamburger shankle biltong beef shank frankfurter pastrami pork chicken.\n\n");

weezing.write("Meatball turducken ribeye pastrami, chuck turkey sirloin. \
Venison capicola rump pork loin. Flank frankfurter bacon capicola.\n\n");