Last active
August 29, 2015 14:01
-
-
Save frohoff/4bed435923c95a0019a8 to your computer and use it in GitHub Desktop.
long stream chain test
This file contains 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
var crypto = require('crypto') | |
var hashType = process.argv[2] || 'sha1' | |
var numHashes = parseInt(process.argv[3] || 1) | |
// init chain with stdout | |
var piped = process.stdout | |
for (var i = 0; i < numHashes; i++) { | |
// prepend chain with new hash | |
var hash = crypto.createHash(hashType) | |
hash.pipe(piped) | |
piped = hash | |
} | |
//pipe stdin into chain | |
process.stdin.pipe(piped) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ cat longchaintest.js | node longchaintest.js sha1 10000 | xxd -ps
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(436 of these total)
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
RangeError: Maximum call stack size exceeded
$