Created
April 8, 2014 07:29
-
-
Save jameswomack/10099526 to your computer and use it in GitHub Desktop.
Clean piped input
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 stream = require('stream'); | |
var util = require('util'); | |
function Clean(options) { | |
if (!(this instanceof Clean)) { | |
return new Clean(options); | |
} | |
stream.Transform.call(this, options); | |
} | |
util.inherits(Clean, stream.Transform); | |
Clean.prototype._transform = function (chunk, enc, done) { | |
this.push(chunk.toString().replace(/aN;(NaN|0)f/,''), 'utf8'); | |
done(); | |
}; | |
module.exports = Clean;% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment