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

Commit eca29f9

Browse files
authored
Merge pull request #13 from oganexon/develop
Develop
2 parents ca4c352 + 2fcdb04 commit eca29f9

39 files changed

+966
-612
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
/dist
55
/tmp
66
/yarn.lock
7+
/coverage
78
node_modules
89
README.html

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
language : node_js
2+
3+
node_js:
4+
- "8"
5+
- "10"
6+
- "12"
7+
8+
os:
9+
- linux
10+
- osx
11+
- windows
12+
13+
cache:
14+
directories:
15+
- "node_modules"
16+
17+
branches:
18+
only:
19+
- master
20+
- develop
21+
22+
install:
23+
- npm install
24+
25+
before_script:
26+
- npm run build-ts
27+
28+
script:
29+
- npm test

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
## [Unreleased]
1616

17+
## [2.0.0] - 2019-08-26
18+
19+
### Added
20+
- End message when the process is finished.
21+
- Types definitions.
22+
- Mute argument in cli.
23+
- New badges in readme.
24+
- Travis Continuous Integration.
25+
26+
### Changed
27+
- All JavaScript files have been converted to TypeScript files.
28+
- 'Method' is now 'standard' in the cli and in the lib.
29+
- Custom standard has changed. See the doc.
30+
31+
### Soon deprecated
32+
- CLI will be ported in its own package.
33+
1734
## [1.1.1] - 2019-08-20
1835

1936
### Added
20-
- Comment on every file.
37+
- Comments on every file.
2138
- Error recap at the end of the process.
2239

2340
## [1.1.0] - 2019-08-19

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<p align="center">
2+
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg?style=for-the-badge&logo=jest" alt="Tested with Jest"></a>
3+
<a href="https://www.npmjs.com"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=for-the-badge&logo=npm" alt="Dependencies"></a>
4+
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=for-the-badge" alt="Node version"></a>
5+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/language-typescript-blue?style=for-the-badge" alt="language"></a>
6+
</p>
7+
<p align="center">
8+
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=for-the-badge" alt="Contributors">
9+
<img src="https://img.shields.io/github/last-commit/oganexon/secure-rm/develop?style=for-the-badge" alt="Last commit">
10+
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=for-the-badge" alt="npm collaborators">
11+
</p>
12+
13+
114
# Contributing / Developing
215

316
Contributions are welcome. Fork this repository and issue a pull request with your changes.

README.md

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
</h1>
77

88
<p align="center">
9-
<a href="https://www.npmjs.com/package/secure-rm"><img src="https://img.shields.io/npm/v/secure-rm.svg" alt="Version"></a>
10-
<a href="https://www.npmjs.com/package/secure-rm"><img src="https://img.shields.io/npm/dw/secure-rm.svg" alt="Downloads/week"></a>
11-
<a href="https://github.com/oganexon/secure-rm/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/secure-rm.svg" alt="License: MIT"></a>
12-
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
9+
<a href="https://www.npmjs.com/package/secure-rm"><img src="https://img.shields.io/npm/v/secure-rm.svg?style=for-the-badge" alt="Version"></a>
10+
<a href="https://www.npmjs.com/package/secure-rm"><img src="https://img.shields.io/npm/dw/secure-rm.svg?style=for-the-badge" alt="Downloads/week"></a>
11+
<a href="https://github.com/oganexon/secure-rm/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/secure-rm.svg?style=for-the-badge" alt="License: MIT"></a>
12+
</p>
13+
<p align="center">
14+
<a href="https://travis-ci.org/oganexon/secure-rm"><img src="https://img.shields.io/travis/oganexon/secure-rm/master.svg?style=for-the-badge&label=master%20build" alt="Build status: master"></a>
15+
<a href="https://travis-ci.org/oganexon/secure-rm"><img src="https://img.shields.io/travis/oganexon/secure-rm/develop.svg?style=for-the-badge&label=development%20build" alt="Build status: develop"></a>
1316
</p>
1417

1518
## ❓ Why
@@ -28,7 +31,7 @@ You can use this package in two different ways, the _npm module version_:
2831
npm install secure-rm --save
2932
```
3033

31-
Or the _command-line version_:
34+
Or the _command-line version_: **(soon deprecated, will be ported to secure-rm-cli)**
3235

3336
```shell
3437
npm install secure-rm -g
@@ -62,6 +65,7 @@ srm('./folder/*.js')
6265
```
6366

6467
### Command line version
68+
**(soon deprecated, will be ported to secure-rm-cli)**
6569

6670
If you want to delete files on the fly, just use the command line tool:
6771
```shell
@@ -79,8 +83,8 @@ secure-rm ./folder/*.js
7983
- a relative path (e.g. `./data/file.js`, `../../data`);
8084
- a [glob pattern](https://www.npmjs.com/package/glob#glob-primer) (e.g. `./*.js`, `./**/*`, `@(pattern|pat*|pat?erN)`).
8185
- `options` [\<Object\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) (optional) :
82-
- `method` [\<String\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) : ID of the method (default: 'secure');
83-
- `customMethod` [\<Function\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) : your own method to remove a file (if specified, priority over `method`);
86+
- `standard` [\<String\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) : ID of the standard (default: 'secure');
87+
- `customStandard` [\<Function\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) : your own standard to remove a file (if specified, priority over `standard`);
8488
- `maxBusyTries` [\<Number\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) : number of retries if an error occur;
8589
- `disableGlob` [\<Boolean\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) : allow or not file globbing (default: true).
8690
- `callback` [\<Function\>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) (if missing, return a promise):
@@ -89,7 +93,7 @@ secure-rm ./folder/*.js
8993
#### Examples:
9094
```javascript
9195
const options = {
92-
method: 'gutmann',
96+
standard: 'gutmann',
9397
maxBusyTries: 5,
9498
disableGlob: true
9599
}
@@ -102,22 +106,24 @@ srm('./data/file*.js', options, (err, path) => {
102106

103107
```javascript
104108
const options = {
105-
customMethod: function (file, callback) {
109+
customStandard: new srm.UnlinkStandard({
110+
method: function (file, callback) {
106111
srm.write.init(file)
107112
.then(({ fileSize, file }) => srm.write.zeroes(file, fileSize))
108113
.then(({ fileSize, file }) => srm.write.ones(file, fileSize))
109114
.then(({ fileSize, file }) => srm.write.random(file, fileSize))
110115
.then(({ file }) => srm.write.unlink(file))
111116
.then(() => callback())
112117
.catch((err) => callback(err))
118+
})
113119
}
114120

115121
srm('./*', options)
116122
.then((path) => console.log(`Successfully removed ${path} !`))
117123
.catch((err) => {throw err})
118124
```
119125
120-
If you want to make your own cutom method, see [write.js](./lib/write.js) file for more details.
126+
If you want to make your own cutom standard, see [write.js](./lib/write.js) file for more details.
121127
122128
#### Events
123129
When running, secure-rm emits events to let you know the progression of the deletion.
@@ -145,15 +151,15 @@ secure-rm <PATHS> [OPTIONS]
145151
- `OPTIONS` (flags):
146152
- `-f, --force`: avoid checks if you want to use it in a shell or bash file;
147153
- `-h, --help`: show CLI help, see below;
148-
- `-m, --method`: numerical ID of the method, default is 0. See them detailed below;
154+
- `-s, --standard`: numerical ID of the standard, default is 0. See them detailed below;
149155
- `-r, --retries`: max retries if an error occur;
150-
- `-t, --table `: show the methods table. See them detailed below;
156+
- `-t, --table `: show the standards table. See them detailed below;
151157
- `-v, --version `: show CLI version;
152158
- `--no-globbing `: disable file globbing.
153159
154160
Example:
155161
```shell
156-
secure-rm ./folder/*.js ./garbage ./file.js -m 6 -f
162+
secure-rm ./folder/*.js ./file.js -s gutmann -f
157163
```
158164
You can invoke the built-in help with `secure-rm -h`:
159165
@@ -162,24 +168,29 @@ You can invoke the built-in help with `secure-rm -h`:
162168
CLI help:
163169
164170
USAGE
165-
$ secure-rm PATH
171+
$ secure-rm PATH
166172
167173
OPTIONS
168-
-f, --force avoid checks
169-
-h, --help show CLI help
170-
-m, --method=method [default: secure] select the erasure method
171-
-r, --retries=retries max retries if error
172-
-t, --table show the methods table
173-
-v, --version show CLI version
174-
--[no-]globbing allow or not file globbing
174+
-f, --force avoid checks
175+
-h, --help show CLI help
176+
-m, --mute mutes the cli to the bare minimum
177+
-r, --retries=retries [default: 3] max retries if error
178+
-s, --standard=standard [default: secure] select the erasure standard
179+
-t, --table show the standards table
180+
-v, --version show CLI version
181+
--[no-]globbing allow or not file globbing
175182
176183
DESCRIPTION
177184
Completely erases files by making recovery impossible.
178185
For extra documentation, go to https://www.npmjs.com/package/secure-rm
186+
187+
EXAMPLES
188+
$ secure-rm ./folder/*.js ./file.js -s gutmann -f
189+
$ secure-rm /d/code -m
179190
```
180191
<!--AUTO GENERATED HELP END-->
181192
182-
### Methods
193+
### Standards
183194
184195
<!--AUTO GENERATED METHODS TABLE START-->
185196
ID | Name | Passes | Description
@@ -188,7 +199,7 @@ ID | Name | Passes | Description
188199
randomByte | Pseudorandom byte | 1 | Overwriting with a random byte.
189200
zeroes | Zeroes | 1 | Overwriting with zeroes.
190201
ones | Ones | 1 | Overwriting with ones.
191-
secure | **Secure-rm method** | 3 | Pass 1: Overwriting with random data;<br>Pass 2: Renaming the file with random data;<br>Pass 3: Truncating between 25% and 75% of the file.
202+
secure | **Secure-rm standard** | 3 | Pass 1: Overwriting with random data;<br>Pass 2: Renaming the file with random data;<br>Pass 3: Truncating between 25% and 75% of the file.
192203
GOST_R50739-95 | Russian State Standard GOST R 50739-95 | 2 | Pass 1: Overwriting with zeroes;<br>Pass 2: Overwriting with random data.
193204
HMG_IS5 | British HMG Infosec Standard 5 | 3 | Also known as "Air Force System Security Instructions AFSSI-5020",<br>"Standard of the American Department of Defense (DoD 5220.22 M)"<br>"National Computer Security Center NCSC-TG-025 Standard"<br>and "Navy Staff Office Publication NAVSO P-5239-26"<br>Pass 1: Overwriting with zeroes;<br>Pass 2: Overwriting with ones;<br>Pass 3: Overwriting with random data as well as verifying the writing of this data.
194205
AR380-19 | US Army AR380-19 | 3 | Pass 1: Overwriting with random data;<br>Pass 2: Overwriting with a random byte;<br>Pass 3: Overwriting with the complement of the 2nd pass, and verifying the writing.
@@ -202,7 +213,7 @@ Note: Node ensures that the file is correctly written, checking the writing in t
202213
203214
## 🚩 Troubleshooting / Common issues
204215
205-
Should works on OS X, Linux, and Windows.
216+
Should works on OS X, Linux (almost, see below), and Windows. (See build status)
206217
207218
### File systems
208219
@@ -241,13 +252,24 @@ See the [changelog](/CHANGELOG.md) or [releases](https://github.com/oganexon/sec
241252
242253
## 📌 TODO
243254
244-
- [x] Release of 1.0.0 (stable API)
245255
- [ ] Implement more tests
246-
- [ ] TypeScript
256+
- [x] TypeScript
247257
- [ ] Support of 64bit files
248258
249259
## 🏗 Contributing
250260
261+
<p align="center">
262+
<a href="https://jestjs.io"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg?style=for-the-badge&logo=jest" alt="Tested with Jest"></a>
263+
<a href="https://www.npmjs.com"><img src="https://img.shields.io/librariesio/release/npm/secure-rm?style=for-the-badge&logo=npm" alt="Dependencies"></a>
264+
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/secure-rm?style=for-the-badge" alt="Node version"></a>
265+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/language-typescript-blue?style=for-the-badge" alt="language"></a>
266+
</p>
267+
<p align="center">
268+
<img src="https://img.shields.io/github/contributors/oganexon/secure-rm?style=for-the-badge" alt="Contributors">
269+
<img src="https://img.shields.io/github/last-commit/oganexon/secure-rm/develop?style=for-the-badge" alt="Last commit">
270+
<img src="https://img.shields.io/npm/collaborators/secure-rm?style=for-the-badge" alt="npm collaborators">
271+
</p>
272+
251273
See [contributing guidelines](/CONTRIBUTING.md)
252274
253275
### Licensing

bin/cli/check.js

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)