glitch
Version:
Glitched stream for intentional data corruption
31 lines (30 loc) • 2.56 kB
JSON
{
"name": "glitch",
"description": "Glitched stream for intentional data corruption",
"version": "0.1.0",
"author": {
"name": "Kevin Chapelier"
},
"main": "./index",
"keywords": [
"glitch",
"stream",
"corruption"
],
"repository": {
"type": "git",
"url": "https://github.com/kchapelier/node-glitch.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/kchapelier/node-glitch/issues"
},
"dependencies": {},
"devDependencies": {},
"homepage": "https://github.com/kchapelier/node-glitch",
"readme" : "# glitch\n\nGlitched stream for intentional data corruption.\n\n## install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install glitch\n```\n\n## API reference\n\n### glitch(fileSrc, fileDst, probability, deviation, mode)\n\n* fileSrc : Source file.\n* fileDst : Destination file.\n* probability : Probability of deviation per byte (between 0 and 1).\n* deviation : Maximum value deviation per byte.\n* mode : File mode\n\n### new glitch.GlitchedStream(options);\n\nTransform stream implementation.\n\nOptions :\n\n* probability : Probability of deviation per byte (between 0 and 1).\n* deviation : Maximum value deviation per byte.\n* whiteList : Array of whitelisted values, if set only bytes with those values will be modified.\n* blackList : Array of blacklisted values, no byte with those values will be modified.\n* deviationFunction : Replace the default deviation function of the stream, allows to write more complex filtering than whitelisting and blacklisting\n\n## Examples\n\n```js\nvar glitch = require('glitch');\nglitch('test.jpg', 'test.glitched.jpg', 0.0001, 2, 0777);\n```\n\nCopy a glitched version of test.jpg as test.glitched.jpg where each byte has probability of 1/10000 of having its value modified by a maximum of 2.\n\n```js\nvar GlitchedStream = require('glitch').GlitchedStream;\nvar gstream = new GlitchedStream({\n 'deviation' : 1,\n 'probability' : 1,\n 'whiteList' : [0xcc,0xcd,0xce,0xcf]\n});\nsomeMidiStream.pipe(gstream).pipe(someMidiReceiver);\n```\n\nPipe a midi stream into a glitched stream which will modify every bytes matching the whitelist by a maximum value of 1 before piping it into midiReceiver.\n\n## Potential use case\n\n* Glitching text files and images (though you'll end up with a lot of totally unreadable files).\n* Testing applications or libraries against failure.\n* Celebrating april's fool day at the expense of a grunt/gulp user.\n\n## License\n\nMIT",
"readmeFilename": "README.md",
"engines": {
"node": ">=0.10"
}
}