The example below first shuffles some bytes in the input file before randomly destorying other bytes.
var byebyte = require('byebyte');
var fs = require('fs');
var input = fs.readFileSync('./some-input-file');
var out = byebyte.shuffle(input, {min:.3, max: .5, chunkMin: 10, chunkMax: 20});
out = byebyte.destroy(out, {min:.51, max:.8});
fs.writeFileSync('./some-output-file');
byebyte.destroy(buffer, opts)
byebyte.destroy
takes a buffer and an options object and returns a buffer.
The options object can have any of the long form flags from the cli command along with:
- getRandomInt: this is a function that takes two ints and returns a random integer in the range.
byebyte.shuffle(buffer, opts)
byebyte.shuffle
takes a buffer and an options object and returns a buffer.
The options object can have any of the long form flags from the cli command along with:
- getRandomInt: this is a function that takes two ints and returns a random integer in the range.