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

Commit 891c8cf

Browse files
authored
Merge pull request #16 from oganexon/develop
2.0.1
2 parents 80580cc + cb95049 commit 891c8cf

13 files changed

+62
-29
lines changed

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
*-debug.log
2-
*-error.log
1+
*.log
32
/.nyc_output
43
/dist
54
/tmp
65
/yarn.lock
76
/coverage
8-
node_modules
9-
README.html
7+
node_modules

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Travis CI
2+
13
language : node_js
24

35
node_js:

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
## [Unreleased]
1616

17+
## [2.0.1] - 2019-08-27
18+
19+
### Added
20+
- Code coverage.
21+
22+
### Deprecated
23+
- The CLI is deprecated, it moved over `secure-rm-cli`.
24+
1725
## [2.0.0] - 2019-08-26
1826

1927
### Added

README.md

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h1 align="center">
2-
<img src="./assets/secure-rm.png" alt="Secure-rm">
2+
<img src="./assets/secure-rm.png" alt="secure-rm">
33
<br>
44
Completely erases files by making recovery impossible.
55
<br>
@@ -27,18 +27,25 @@ Permanent data erasure goes beyond basic file deletion commands, which:
2727

2828
## 📦 Install
2929

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

3232
```shell
33-
npm install secure-rm --save
33+
npm install secure-rm
3434
```
3535

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

3838
```shell
3939
npm install secure-rm -g
4040
```
4141

42+
Move over `secure-rm-cli`:
43+
44+
```shell
45+
npm install secure-rm-cli -g
46+
```
47+
48+
4249
Secure-rm will retry 3 times if an error occur to ensure the task succeeded.
4350

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

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

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

7784
## 📚 Usage
7885

79-
### npm module
80-
8186
**`rm(path[, options] [, callback])`**
8287

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

95-
#### Examples:
100+
### Examples:
96101
```javascript
97102
const options = {
98103
standard: 'gutmann',
@@ -127,7 +132,7 @@ srm('./*', options)
127132
128133
If you want to make your own cutom standard, see [write.js](./lib/write.js) file for more details.
129134
130-
#### Events
135+
### Events
131136
When running, secure-rm emits events to let you know the progression of the deletion.
132137
133138
You can indeed intercept error and ending events for _each_ file.
@@ -143,7 +148,7 @@ srm.event.on('warn', (file, err) => console.log('Warning ' + err + file))
143148
srm.event.on('error', (file, err) => console.log('Error ' + err + file))
144149
```
145150
146-
### Command line tool
151+
### Command line tool **🚨 Deprecated 🚨**
147152
```shell
148153
secure-rm <PATHS> [OPTIONS]
149154
```
@@ -194,7 +199,6 @@ EXAMPLES
194199
195200
### Standards
196201
197-
<!--AUTO GENERATED METHODS TABLE START-->
198202
ID | Name | Passes | Description
199203
-- | ---- | ------ | -----------
200204
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.)
@@ -209,9 +213,8 @@ ID | Name | Passes | Description
209213
schneier | Bruce Schneier Algorithm | 7 | Pass 1: Overwriting with zeros;<br>Pass 2: Overwriting with ones;<br>Pass 3-7: Overwriting with random data.
210214
pfitzner | Pfitzner Method | 33 | Pass 1-33: Overwriting with random data.
211215
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.
212-
<!--AUTO GENERATED METHODS TABLE END-->
213216
214-
Note: Node ensures that the file is correctly written, checking the writing in these algorithms is unnecessary.
217+
Note: Node ensures that the file is correctly written, checking the writing in these algorithms is unnecessary. (Report this if I'm wrong)
215218
216219
## 🚩 Troubleshooting / Common issues
217220
@@ -242,9 +245,9 @@ If you really need to delete millions of file in one time, split the task (e.g.
242245
243246
### Using Windows:
244247
245-
Be sure to use `secure-rm ".\path\file"` with doublequotes since back-slashes will always be interpreted as escape characters, not path separators.
248+
Be sure to use `".\path\file"` with doublequotes since back-slashes will always be interpreted as escape characters, not path separators.
246249
247-
Another solution is to double the back-slashes like: `secure-rm .\\path\\file`
250+
Another solution is to double the back-slashes like: `.\\path\\file`
248251
249252
Or if you can, use forward slashes!
250253
@@ -255,7 +258,6 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
255258
## 📌 TODO
256259
257260
- [ ] Implement more tests
258-
- [x] TypeScript
259261
- [ ] Support of 64bit files
260262
261263
## 🏗 Contributing
@@ -264,7 +266,7 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
264266
<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>
265267
<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>
266268
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=flat-square" alt="Node version"></a>
267-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/language-typescript-blue?style=flat-square" alt="language"></a>
269+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/github/languages/top/oganexon/secure-rm?style=flat-square" alt="language"></a>
268270
</p>
269271
<p align="center">
270272
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=flat-square" alt="Contributors">

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "secure-rm",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Completely erases files by making recovery impossible.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
@@ -14,7 +14,6 @@
1414
"coverage": "jest --coverage --coverageReporters=text-lcov | coveralls",
1515
"test": "jest --coverage --verbose",
1616
"watch-test": "npm run test -- --watchAll",
17-
"release": "np",
1817
"style": "standard --verbose --env jest"
1918
},
2019
"dependencies": {
@@ -33,7 +32,6 @@
3332
"@types/jest": "^24.0.18",
3433
"coveralls": "^3.0.6",
3534
"jest": "^24.8.0",
36-
"np": "^5.0.3",
3735
"standard": "^12.0.1",
3836
"ts-jest": "^24.0.2",
3937
"ts-node": "^8.3.0",

src/cli/check.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import inquirer from 'inquirer'
22
import chalk from 'chalk'
33
import { standards, event } from '..'
44
import srm from '..'
5+
require('./deprecated')
56

67
let log: any
78

src/cli/deprecated.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import chalk from 'chalk'
2+
import Table from 'tty-table'
3+
4+
process.on('exit', () => {
5+
const rows = [[`The use of the secure-rm CLI is ${chalk.red.bold('deprecated')}.
6+
Migrate over ➜ ${chalk.green('secure-rm-cli')}. Run:
7+
${chalk.cyan('npm un secure-rm -g')}
8+
${chalk.cyan('npm i secure-rm-cli -g')}`]]
9+
10+
const t1 = Table([], rows, {
11+
borderStyle: 1,
12+
borderColor: 'yellow',
13+
paddingBottom: 0,
14+
headerAlign: 'center',
15+
headerColor: 'yellow',
16+
align: 'center',
17+
color: 'white'
18+
// truncate: "..."
19+
})
20+
21+
const str1 = t1.render()
22+
console.log(str1)
23+
})
24+

src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { unlink, Options, Callback} from './lib/secure-rm'
2-
import { validIDs, standards, UnlinkStandard } from './lib/standards'
3-
import { write, eventEmitter } from './lib/write'
1+
import { unlink, Options, Callback} from './secure-rm'
2+
import { validIDs, standards, UnlinkStandard } from './standards'
3+
import { write, eventEmitter } from './write'
44

55
interface SecureRm {
66
(path: string, options?: Options | Callback, callback?: Callback): typeof unlink;
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/dist/write/write-non-random.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs')
22
const util = require('util')
33
const uuidv4 = require('uuid/v4')
4-
const { write } = require('../../../dist/lib/write')
4+
const { write } = require('../../../dist/write')
55
const expected = require('./write-non-random-expectation.js')
66

77
const readFile = util.promisify(fs.readFile)

test/dist/write/write-specific.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path')
33
const util = require('util')
44
const crypto = require('crypto')
55
const uuidv4 = require('uuid/v4')
6-
const { write } = require('../../../dist/lib/write')
6+
const { write } = require('../../../dist/write')
77

88
const readFile = util.promisify(fs.readFile)
99
const writeFile = util.promisify(fs.writeFile)

0 commit comments

Comments
 (0)