Last active
October 12, 2017 19:43
-
-
Save caub/15109d6c815cb1f276bb3f399bf5cd46 to your computer and use it in GitHub Desktop.
a fast yes implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Readable } = require('stream'); | |
const ys = Buffer.from('y\n'.repeat(2**16)); | |
class Y extends Readable { | |
_read(size) { | |
this.push(ys.slice(0, size)); | |
} | |
} | |
new Y().pipe(process.stdout); // test with node yes | pv -r > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment