Data erasure solution for files and drives
Secure-rm is composed of two parts: a Node.js module with a straightforward API and a command line interface optimized to delete files on the fly.
When you delete a file using the rm
UNIX command or fs.unlink
in node, it only removes direct pointers to the data disk sectors and make the data recovery possible with common software tools.
Permanent data erasure goes beyond basic file deletion commands, which:
- Allow for selection of a specific standard, based on unique needs,
- Verify the overwriting method has been successful and removed data across the entire device.
The basic principle is to write files before deletion in order to make recovery harder. With secure-rm, you get to choose the standard that follow your needs. Each one is composed of instructions about how many passes it should perform.
It goes from a simple pass of zeros to a 35 passes algorithm. Secure-rm comes with its own algorithm to ensure your data is safe:
- A pass of cryptographically strong pseudo-random data,
- The file is then renamed,
- And finally truncated to hide the file size.
π Documentation
$ yarn add secure-rm
# or
$ npm install secure-rm
If you want your application to delete specific files with a pass of cryptographically strong pseudo-random data, use one of these code snippets:
const srm = require('secure-rm')
srm.remove('./folder/file.js').result
.then(() => console.log('Files successfully deleted !'))
.catch(console.error)
// OR
srm.remove('./folder/file.js', (err) => {
if (err) throw err
console.log('Files successfully deleted !')
})
const options = {
standard: srm.standards.gutmann,
maxBusyTries: 5
}
srm.remove('./data/file.js', options).result
.then(({count, index}) => console.log(`Successfully deleted ${count} files: ${index}`))
.catch(console.error)
const events = srm.remove('./trash/dir/', { standard: srm.standards.schneier }, (err, {count, index}) => {
if (err) throw err
console.log(`Successfully deleted ${count} files: ${index}`))
})
event.on('removed', (fileName) => console.log(fileName))
See the changelog or releases.
[] Fix wipeDrive (removed from 5.0)
Icon library by Icons8.
This project is under MIT License.