{"id":21074799,"url":"https://github.com/dawsbot/skrub","last_synced_at":"2025-05-16T06:31:30.046Z","repository":{"id":57362478,"uuid":"58791813","full_name":"dawsbot/skrub","owner":"dawsbot","description":"Irreversible file deletion on every OS","archived":false,"fork":false,"pushed_at":"2017-02-20T21:31:57.000Z","size":1732,"stargazers_count":50,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-11T20:38:43.399Z","etag":null,"topics":["file-deletion","iteration","overwrites","security"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dawsbot.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-14T05:47:42.000Z","updated_at":"2021-03-26T03:48:07.000Z","dependencies_parsed_at":"2022-09-26T16:32:10.032Z","dependency_job_id":null,"html_url":"https://github.com/dawsbot/skrub","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fskrub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fskrub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fskrub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fskrub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawsbot","download_url":"https://codeload.github.com/dawsbot/skrub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225411493,"owners_count":17470246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-deletion","iteration","overwrites","security"],"created_at":"2024-11-19T19:18:03.322Z","updated_at":"2024-11-19T19:18:04.128Z","avatar_url":"https://github.com/dawsbot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca\u003e\u003cimg src=\"img/logo.png\" title=\"skrub logo\"/\u003e\u003c/a\u003e\n\n  \u003cbr\u003e\n\n  \u003cb\u003eIrreversible file deletion on every operating system\u003c/b\u003e\n  \u003cbr\u003e\n  \u003ci\u003e* Will only work securely on file systems that overwrite blocks in place *\u003c/i\u003e\n\n  \u003cbr\u003e\n  \u003cbr\u003e\u003cbr\u003e\u003ca href=\"https://travis-ci.org/dawsbot/skrub\"\u003e\u003cimg src=\"https://api.travis-ci.org/dawsbot/skrub.svg?branch=master\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://ci.appveyor.com/project/dawsbot/skrub\"\u003e\u003cimg src=\"https://ci.appveyor.com/api/projects/status/3x9sboy9jsil33mb?svg=true\"\u003e\u003c/a\u003e\n\n  \u003cbr\u003e\n\n  \u003ca href=\"https://www.npmjs.com/package/skrub\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/skrub.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"http://npmjs.org/skrub\"\u003e\u003cimg src=\"http://img.shields.io/npm/dm/skrub.svg?style=flat\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/sindresorhus/xo\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-XO-5ed9c7.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\nIn contrast to `rm`, which [leaves file contents unallocated in memory](http://unix.stackexchange.com/questions/10883/where-do-files-go-when-the-rm-command-is-issued), `skrub` first floods file(s) with garbage data and then **removes them forever**.\n\nThe current method is low fidelity and \"will prevent the data from being retrieved simply by reading using standard system functions\". Read more in the [FAQ](#faq) below or on Wikipedia [here](https://en.wikipedia.org/wiki/Data_remanence#Overwriting).\n\nWorks on OS X, Linux, **and** Windows.\n\nLooking for the [command-line version](https://github.com/dawsbot/skrub-cli)?\n\n\u003cbr\u003e\n\n## Install\n\n```\nnpm install --save skrub\n```\n\n\u003cbr\u003e\n\nOr try the [command-line version](https://github.com/dawsbot/skrub-cli)\n```\nnpm install --global skrub\n```\n\u003cbr\u003e\n\n## Usage\n\n```js\nconst skrub = require('skrub');\n\nskrub(['*', '!important*']).then(paths =\u003e {\n    console.log('Skrubbed files and folders:\\n', paths.join('\\n'));\n});\n```\n\n*You can use [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).*\n\n\u003cbr\u003e\n\n## API\n\n### skrub(patterns, [options])\n\nReturns a promise for an array of skrubbed paths.\n\n#### patterns\n\nType: `string`, `array`\n\nSee supported minimatch [patterns](https://github.com/isaacs/minimatch#usage).\n\n- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test.js)\n- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)\n\n#### options\n\nType: `object`\n\n##### dryRun\n\nType: `boolean`\u003cbr /\u003e\nDefault: `false`\n\nSee what would be skrubbed without actually deleting anything.\n\n```js\nskrub(['tmp/*.js'], {dryRun: true}).then(paths =\u003e {\n  console.log('Files and folders that would be skrubbed:\\n', paths.join('\\n'));\n});\n```\n\nIn additon to these two options, all `node-glob` [options](https://github.com/isaacs/node-glob#options) are also available.\n\n##### iterations\n\nType: `number`(must be \u003e= 0)\u003cbr /\u003e\nDefault: 1\n\nZero-fill the specified file multiple times.\n\n```js\nskrub(['tmp/*.js'], {iterations: 7}).then(paths =\u003e {\n  console.log('Files and folders that would be skrubbed:\\n', paths.join('\\n'));\n});\n```\n\n\u003cbr\u003e\n\n### skrub.floodFile(filePath, iterations)\n\nReturns a promise for the flooded filePath. Replaces the contents of file at `filePath` with the same amount of bytes zero-filled.\n\n#### filePath\n\nType: `string`\n\n#### iterations\n\nType: `number`(must be \u003e= 0)\u003cbr /\u003e\nDefault: 1\n\nZero-fill the specified file multiple times.\n\n\u003cbr\u003e\n\n## FAQ\n\n### Unreliable file systems\n`skrub` and other overwriting-based methods *may not be effective* on your file system, since the disk may not actually write where you think it's writing. Here is a list of systems which are known not to cooperate with the current file overwriting method. [Why don't these work?](http://cseweb.ucsd.edu/~m3wei/assets/pdf/FMS-2010-Secure-Erase.pdf)\n* [copy-on-write systems](https://en.wikipedia.org/wiki/Copy-on-write) like btrfs\n* ssd's at large\n* reiserfs\n* COW\n\nIn the above scenarios, `skrub` is just a friendly wrapper around `rm`.\n\n### How secure is this?\nAt a minimum, this will prevent the data from being retrieved simply by reading from the media again using standard system functions.\n\n### But I can do the same thing with `rm`\n\nNot really. The `rm` command simply frees the file-pointer in your operating system. This allows the file contents to be written over **at a later date**. This means that during the time before that memory location is needed (which it may never), your data is still at rest on your system.\n\n`rm` ships with a `-P` flag which first does file overwrites with blank data. Although the end result is similar, this does not support negation in globbing and is not cross-platform.\n\n### But I can do the same thing with `shred`\n\nNot the case. The `shred` command is a Linux only distribution while `skrub` is cross-platform. `skrub` also supports negation within file globbing. `shred` does not have a friendly node.js module wrapper around it either.\n\n\u003cbr\u003e\n\n## Benchmarking\n\nTL;DR: Running more iterations than one is hardly slower.\n```\nskrub(tempFile, {iterations: 1}) x 57,512 ops/sec ±2.60% (69 runs sampled)\nskrub(tempFile, {iterations: 7}) x 54,338 ops/sec ±2.59% (82 runs sampled)\nskrub(tempFile, {iterations: 36}) x 54,631 ops/sec ±2.95% (79 runs sampled)\nFastest is skrub(tempFile, {iterations: 1})\n```\n\nTry it yourself:\n\n```shell\nnpm run benchmark\n```\n\n\u003cbr\u003e\n\n## Related\n\n* [skrub-cli](https://github.com/dawsbot/skrub-cli)\n* [file-wipe](https://github.com/simonlovesyou/file-wipe)\n* [del](https://github.com/sindresorhus/del)\n* [trash](https://github.com/sindresorhus/trash)\n\n\u003cbr\u003e\n\n## License\n\nMIT © [Dawson Botsford](http://dawsonbotsord.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsbot%2Fskrub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawsbot%2Fskrub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsbot%2Fskrub/lists"}