index.js
function(fileSrc, fileDst, probability, deviation, mode) {
  "use strict";
  var rstream = fs.createReadStream(fileSrc);
  var woptions = mode ? { 'mode' : mode } : {};
  var wstream = fs.createWriteStream(fileDst, woptions);
  var gstream = new GlitchedStream({
    'probability' : probability,
    'deviation' : deviation
  });

  rstream.pipe(gstream).pipe(wstream);
}
function(fileSrc, fileDst, probability, deviation, mode) {
  "use strict";
  var rstream = fs.createReadStream(fileSrc);
  var woptions = mode ? { 'mode' : mode } : {};
  var wstream = fs.createWriteStream(fileDst, woptions);
  var gstream = new GlitchedStream({
    'probability' : probability,
    'deviation' : deviation
  });

  rstream.pipe(gstream).pipe(wstream);
}
function ( fileSrc , fileDst , probability , deviation , mode ) { "use strict" ; var rstream = fs . createReadStream ( fileSrc ) ; var woptions = mode ? { 'mode' : mode } : { } ; var wstream = fs . createWriteStream ( fileDst , woptions ) ; var gstream = new GlitchedStream ( { 'probability' : probability , 'deviation' : deviation } ) ; rstream . pipe ( gstream ) . pipe ( wstream ) ; }
Read the content of a file, corrupt it and write it into another file
@param {String} fileSrc - Path of the source file
@param {String} fileDst - Path of the destination file
@param {Number} probability - Probability of deviation per byte (between 0 and 1)
@param {Number} deviation - Maximum value difference between each byte of the source and of the destination
@param {Number} mode
Read the content of a file corrupt it and write it into another file