Streaming number generator for e
π
and primes using spigot algorithms
Node.js streams handle backpressure
Pipe a number spigot and stream numbers
Example:
- run as cli
node lib/prime
- pipe with bash
node lib/pi | less
node lib/prime > primes.txt
- pipe into your node app
const EulerSpigot = require('number-spigot').e;
const spigot = new EulerSpigot();
spigot
.pipe(myTransform)
.pipe(process.stdout);
For more complete examples, look into the examples folder