Created
December 18, 2014 02:43
-
-
Save cjpartridgeb/a81834c87f134a05af23 to your computer and use it in GitHub Desktop.
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
function maxThrough(max) { | |
var b=0; | |
return through2(function(chunk,enc,callback) { | |
b+=chunk.length; | |
if(b>max) return callback(new Error('Too many bites!')); | |
this.push(chunk); | |
callback(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment