Skip to content

Instantly share code, notes, and snippets.

@jameswomack
Created April 8, 2014 07:29
Show Gist options
  • Save jameswomack/10099526 to your computer and use it in GitHub Desktop.
Save jameswomack/10099526 to your computer and use it in GitHub Desktop.
Clean piped input
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