Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #16 from oganexon/develop
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
SteelAlloy authored Aug 27, 2019
2 parents 80580cc + cb95049 commit 891c8cf
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 29 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
*-debug.log
*-error.log
*.log
/.nyc_output
/dist
/tmp
/yarn.lock
/coverage
node_modules
README.html
node_modules
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Travis CI

language : node_js

node_js:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.1] - 2019-08-27

### Added
- Code coverage.

### Deprecated
- The CLI is deprecated, it moved over `secure-rm-cli`.

## [2.0.0] - 2019-08-26

### Added
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 align="center">
<img src="./assets/secure-rm.png" alt="Secure-rm">
<img src="./assets/secure-rm.png" alt="secure-rm">
<br>
Completely erases files by making recovery impossible.
<br>
Expand Down Expand Up @@ -27,18 +27,25 @@ Permanent data erasure goes beyond basic file deletion commands, which:

## 📦 Install

You can use this package in two different ways, the _npm module version_:
To install this package, just run: (Node and npm required)

```shell
npm install secure-rm --save
npm install secure-rm
```

Or the _command-line version_: **(soon deprecated, will be ported to secure-rm-cli)**
Or the _command-line version_: **🚨 Deprecated 🚨**

```shell
npm install secure-rm -g
```

Move over `secure-rm-cli`:

```shell
npm install secure-rm-cli -g
```


Secure-rm will retry 3 times if an error occur to ensure the task succeeded.

## 🚀 Getting started
Expand Down Expand Up @@ -66,7 +73,7 @@ srm('./folder/*.js')
.catch((err) => {throw err})
```

### Command line version
### Command line version **🚨 Deprecated 🚨**
**(soon deprecated, will be ported to secure-rm-cli)**

If you want to delete files on the fly, just use the command line tool:
Expand All @@ -76,8 +83,6 @@ secure-rm ./folder/*.js

## 📚 Usage

### npm module

**`rm(path[, options] [, callback])`**

- `path` [\<String\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) :
Expand All @@ -92,7 +97,7 @@ secure-rm ./folder/*.js
- `callback` [\<Function\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) (if missing, return a promise):
- returns `err` [\<Error\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) when finished.

#### Examples:
### Examples:
```javascript
const options = {
standard: 'gutmann',
Expand Down Expand Up @@ -127,7 +132,7 @@ srm('./*', options)
If you want to make your own cutom standard, see [write.js](./lib/write.js) file for more details.
#### Events
### 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.
Expand All @@ -143,7 +148,7 @@ srm.event.on('warn', (file, err) => console.log('Warning ' + err + file))
srm.event.on('error', (file, err) => console.log('Error ' + err + file))
```
### Command line tool
### Command line tool **🚨 Deprecated 🚨**
```shell
secure-rm <PATHS> [OPTIONS]
```
Expand Down Expand Up @@ -194,7 +199,6 @@ EXAMPLES
### Standards
<!--AUTO GENERATED METHODS TABLE START-->
ID | Name | Passes | Description
-- | ---- | ------ | -----------
randomData | Pseudorandom data | 1 | Also kwown as "Australian Information Security Manual Standard ISM 6.2.92"<br>and "New Zealand Information and Communications Technology Standard NZSIT 402" <br>Your data is overwritten with cryptographically strong pseudo-random data. (The data is indistinguishable from random noise.)
Expand All @@ -209,9 +213,8 @@ ID | Name | Passes | Description
schneier | Bruce Schneier Algorithm | 7 | Pass 1: Overwriting with zeros;<br>Pass 2: Overwriting with ones;<br>Pass 3-7: Overwriting with random data.
pfitzner | Pfitzner Method | 33 | Pass 1-33: Overwriting with random data.
gutmann | Peter Gutmann Algorithm | 35 | Pass 1-4: Overwriting with random data;<br>Pass 5: Overwriting with 0x55;<br>Pass 6: Overwriting with 0xAA;<br>Pass 7-9: Overwriting with 0x92 0x49 0x24, then cycling through the bytes;<br>Pass 10-25: Overwriting with 0x00, incremented by 1 at each pass, until 0xFF;<br>Pass 26-28: Same as 7-9;<br>Pass 29-31: Overwriting with 0x6D 0xB6 0xDB, then cycling through the bytes;<br>Pass 32-35: Overwriting with random data.
<!--AUTO GENERATED METHODS TABLE END-->
Note: Node ensures that the file is correctly written, checking the writing in these algorithms is unnecessary.
Note: Node ensures that the file is correctly written, checking the writing in these algorithms is unnecessary. (Report this if I'm wrong)
## 🚩 Troubleshooting / Common issues
Expand Down Expand Up @@ -242,9 +245,9 @@ If you really need to delete millions of file in one time, split the task (e.g.
### Using Windows:
Be sure to use `secure-rm ".\path\file"` with doublequotes since back-slashes will always be interpreted as escape characters, not path separators.
Be sure to use `".\path\file"` with doublequotes since back-slashes will always be interpreted as escape characters, not path separators.
Another solution is to double the back-slashes like: `secure-rm .\\path\\file`
Another solution is to double the back-slashes like: `.\\path\\file`
Or if you can, use forward slashes!
Expand All @@ -255,7 +258,6 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
## 📌 TODO
- [ ] Implement more tests
- [x] TypeScript
- [ ] Support of 64bit files
## 🏗 Contributing
Expand All @@ -264,7 +266,7 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg?style=flat-square&logo=jest" alt="Tested with Jest"></a>
<a href="https://www.npmjs.com"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=flat-square&logo=npm" alt="Dependencies"></a>
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=flat-square" alt="Node version"></a>
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/language-typescript-blue?style=flat-square" alt="language"></a>
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/github/languages/top/oganexon/secure-rm?style=flat-square" alt="language"></a>
</p>
<p align="center">
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=flat-square" alt="Contributors">
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "secure-rm",
"version": "2.0.0",
"version": "2.0.1",
"description": "Completely erases files by making recovery impossible.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -14,7 +14,6 @@
"coverage": "jest --coverage --coverageReporters=text-lcov | coveralls",
"test": "jest --coverage --verbose",
"watch-test": "npm run test -- --watchAll",
"release": "np",
"style": "standard --verbose --env jest"
},
"dependencies": {
Expand All @@ -33,7 +32,6 @@
"@types/jest": "^24.0.18",
"coveralls": "^3.0.6",
"jest": "^24.8.0",
"np": "^5.0.3",
"standard": "^12.0.1",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
Expand Down
1 change: 1 addition & 0 deletions src/cli/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import inquirer from 'inquirer'
import chalk from 'chalk'
import { standards, event } from '..'
import srm from '..'
require('./deprecated')

let log: any

Expand Down
24 changes: 24 additions & 0 deletions src/cli/deprecated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import chalk from 'chalk'
import Table from 'tty-table'

process.on('exit', () => {
const rows = [[`The use of the secure-rm CLI is ${chalk.red.bold('deprecated')}.
Migrate over ➜ ${chalk.green('secure-rm-cli')}. Run:
${chalk.cyan('npm un secure-rm -g')}
${chalk.cyan('npm i secure-rm-cli -g')}`]]

const t1 = Table([], rows, {
borderStyle: 1,
borderColor: 'yellow',
paddingBottom: 0,
headerAlign: 'center',
headerColor: 'yellow',
align: 'center',
color: 'white'
// truncate: "..."
})

const str1 = t1.render()
console.log(str1)
})

6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { unlink, Options, Callback} from './lib/secure-rm'
import { validIDs, standards, UnlinkStandard } from './lib/standards'
import { write, eventEmitter } from './lib/write'
import { unlink, Options, Callback} from './secure-rm'
import { validIDs, standards, UnlinkStandard } from './standards'
import { write, eventEmitter } from './write'

interface SecureRm {
(path: string, options?: Options | Callback, callback?: Callback): typeof unlink;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/dist/write/write-non-random.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const util = require('util')
const uuidv4 = require('uuid/v4')
const { write } = require('../../../dist/lib/write')
const { write } = require('../../../dist/write')
const expected = require('./write-non-random-expectation.js')

const readFile = util.promisify(fs.readFile)
Expand Down
2 changes: 1 addition & 1 deletion test/dist/write/write-specific.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path')
const util = require('util')
const crypto = require('crypto')
const uuidv4 = require('uuid/v4')
const { write } = require('../../../dist/lib/write')
const { write } = require('../../../dist/write')

const readFile = util.promisify(fs.readFile)
const writeFile = util.promisify(fs.writeFile)
Expand Down

0 comments on commit 891c8cf

Please sign in to comment.