JSPM

  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q73865F
  • License MIT

Completely erases files by making recovery impossible.

Package Exports

  • secure-rm

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (secure-rm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Logo of the project
Completely erases files by making recovery impossible.

Version Downloads/week License

⚠️ WARNING ⚠️ THIS TOOL IS STILL IN DEVELOPEMENT, USE IT AT YOUR OWN RISKS! But it will be ready soon...

Install

You can use this package in two different ways, the npm module version:

$ npm install secure-rm --save

Or the command-line version:

$ npm install secure-rm -g

Getting started

If you want your application to delete specific files with a pass of cryptographically strong pseudo-random data, use this code snippet:

const rm = require('secure-rm')

rm('./folder/*.js', (err) => {
  if (err) throw err
  console.log('Success!')
})

If you want to delete files on the fly, just use the command line tool:

$ secure-rm ./folder/*.js

Usage

npm module

rm(path[, method], callback)

  • path :
    • an absolute path (e.g. D:\data, /d/data)
    • a relative path (e.g. ./data/file.js, ../../data)
    • a glob pattern (e.g. ./*.js, ./**/*, @(pattern|pat*|pat?erN))
  • method (optional):
    • By default, method 0 (Pseudorandom data)
    • You can pick another one, they are described below.
  • callback
    • returns err when finished.

Exemple:

rm('./data/file.js', '7' (err) => {
  if (err) throw err
  console.log('Success!')
})

Events

When running, secure-rm emits events to let you know the progression of the deletion.

You can indeed intercept error and ending events for each file.

rm.event.on('starting', (file) => console.log('Starting ' + file))
rm.event.on('unlinking', (file) => console.log('Unlinking ' + file))
rm.event.on('done', (file) => console.log('Done ' + file))

rm.event.on('info', (file, info) => console.log('Info ' + info + file))

rm.event.on('warn', (file, err) => console.log('Warning ' + err + file))
rm.event.on('error', (file, err) => console.log('Error ' + err + file))

Command line tool

$ secure-rm <PATHS> [OPTIONS]

The tool supports file globbing and multiple arguments like:

$ secure-rm ./folder/*.js ./garbage ./file.js

The different flags are detailed in the built-in help:

CLI help:

USAGE
  $ secure-rm PATH

OPTIONS
  -f, --force                   avoid checks
  -h, --help                    show CLI help
  -m, --method=0|1|2|3|4|5|6|7  select the erasure method
  -t, --table                   show the methods table
  -v, --version                 show CLI version

DESCRIPTION
  Completely erases files by making recovery impossible.
  For extra documentation, go to https://www.npmjs.com/package/secure-rm

Methods

ID Name Passes Description
0 Pseudorandom data 1 Your data is overwritten with cryptographically strong pseudo-random data. (The data is indistinguishable from random noise.)
1 Pseudorandom byte 1 Overwriting with a random byte.
2 Zeroes 1 Overwriting with zeroes.
3 Ones 1 Overwriting with ones.
4 Russian GOST P50739-95 2 Pass 1: Overwriting with zeroes;
Pass 2: Overwriting with random data.
5 British HMG Infosec Standard 5 3 Pass 1: Overwriting with zeroes;
Pass 2: Overwriting with ones;
Pass 3: Overwriting with random data as well as verifying the writing of this data.
6 US Army AR380-19 3 Pass 1: Overwriting with random data;
Pass 2: Overwriting with a random byte;
Pass 3: Overwriting with the complement of the 2nd pass, and verifying the writing.
7 US Department of Defense DoD 5220.22-M (E) 3 Pass 1: Overwriting with zeroes as well as checking the writing;
Pass 2: Overwriting with ones and checking the writing;
Pass 3: Overwriting with random data as well as verifying the writing.

Developing

Prerequisites

You need to have Git and npm installed on your system.

Setting up Dev

You'll need to clone the repository and install the required packages. Just execute these commands:

git clone https://github.com/oganexon/secure-rm.git
cd ./secure-rm/
npm install

You are ready to develop.

Deploying / Publishing

give instructions on how to build and release a new version In case there's some step you have to take that publishes this project to a server, this is the right time to state it.

packagemanager deploy your-project -s server.com -u username -p password

And again you'd need to tell what the previous code actually does.

Versioning

We use SemVer for versioning. For the versions available, see the link to tags on this repository.

Configuration

Here you should write what are all of the configurations a user can enter when using the project.

Tests

Describe and show how to run the tests with code examples. Explain what these tests test and why.

Give an example

Style guide

Explain your code style and show how to check it.

JavaScript Style Guide

Licensing

State what the license is and how to find the text version of the license.