The 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 below or on Wikipedia here.
See what would be skrubbed without actually deleting anything.
skrub(['tmp/*.js'], {dryRun: true}).then(paths => { console.log('Files and folders that would be skrubbed:\n', paths.join('\n'));});
In additon to these two options, all node-globoptions are also available.
iterations
Type: number(must be >= 0)
Default: 1
Zero-fill the specified file multiple times.
skrub(['tmp/*.js'], {iterations: 7}).then(paths => { console.log('Files and folders that would be skrubbed:\n', paths.join('\n'));});
skrub.floodFile(filePath, iterations)
Returns a promise for the flooded filePath. Replaces the contents of file at filePath with the same amount of bytes zero-filled.
filePath
Type: string
iterations
Type: number(must be >= 0)
Default: 1
Zero-fill the specified file multiple times.
FAQ
Unreliable file systems
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?
In the above scenarios, skrub is just a friendly wrapper around rm.
How secure is this?
At a minimum, this will prevent the data from being retrieved simply by reading from the media again using standard system functions.
But I can do the same thing with rm
Not 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.
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.
But I can do the same thing with shred
Not 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.
Benchmarking
TL;DR: Running more iterations than one is hardly slower.
skrub(tempFile, {iterations: 1}) x 57,512 ops/sec ±2.60% (69 runs sampled)skrub(tempFile, {iterations: 7}) x 54,338 ops/sec ±2.59% (82 runs sampled)skrub(tempFile, {iterations: 36}) x 54,631 ops/sec ±2.95% (79 runs sampled)Fastest is skrub(tempFile, {iterations: 1})