Comparing version 2.0.0 to 3.0.0
{ | ||
"name": "trash", | ||
"version": "2.0.0", | ||
"description": "Cross-platform command-line app for moving files and directories to the trash - A safer alternative to `rm`", | ||
"version": "3.0.0", | ||
"description": "Move files and directories to the trash", | ||
"license": "MIT", | ||
@@ -12,4 +12,2 @@ "repository": "sindresorhus/trash", | ||
}, | ||
"bin": "cli.js", | ||
"preferGlobal": true, | ||
"engines": { | ||
@@ -19,17 +17,17 @@ "node": ">=0.10.0" | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"cli-app", | ||
"cli", | ||
"bin", | ||
"trash", | ||
"recycle", | ||
"bin", | ||
"rm", | ||
"rmrf", | ||
"rimraf", | ||
"remove", | ||
"delete", | ||
"del", | ||
"file", | ||
@@ -40,18 +38,20 @@ "files", | ||
"directories", | ||
"shell", | ||
"script" | ||
"xdg" | ||
], | ||
"dependencies": { | ||
"each-async": "^1.1.1", | ||
"meow": "^3.0.0", | ||
"osx-trash": "^1.0.1", | ||
"path-exists": "^1.0.0", | ||
"update-notifier": "^0.3.0", | ||
"win-trash": "^1.0.1", | ||
"xdg-trash": "^1.0.0" | ||
"osx-trash": "^2.0.0", | ||
"win-trash": "^2.0.0", | ||
"xdg-trash": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"path-exists": "^1.0.0" | ||
"ava": "*", | ||
"path-exists": "^2.0.0", | ||
"tempfile": "^1.1.1", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"ignore": [ | ||
"test.js" | ||
] | ||
} | ||
} |
@@ -1,42 +0,25 @@ | ||
# ![trash](https://cdn.rawgit.com/sindresorhus/trash/3aa70853f1efb58d0d2512e32d617d246c88953c/media/logo.svg) | ||
# ![trash](https://cdn.rawgit.com/sindresorhus/trash/1cdbd660976d739eeb45447bb6b62c41ac4a3ecf/media/logo.svg) | ||
> Cross-platform command-line app for moving files and directories to the trash | ||
> A safer alternative to [`rm`](http://en.wikipedia.org/wiki/Rm_(Unix)) | ||
> Move files and directories to the trash | ||
[![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash) ![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg) | ||
[![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash) | ||
Works on OS X, Linux and Windows. | ||
Works on OS X, Linux, and Windows. | ||
In contrast to `rm` which is [dangerous](http://docstore.mik.ua/orelly/unix3/upt/ch14_03.htm) and permanently delete files, this only moves them to the trash, which is much safer and reversible. You should not alias `rm` to `trash` however as that would break most scripts relying on `rm` behaviour. Rather use `trash` from the CLI and in your own scripts. I would also recommend reading my guide on [safeguarding `rm`](https://github.com/sindresorhus/guides/blob/master/how-not-to-rm-yourself.md#safeguard-rm). | ||
In contrast to [`fs.unlink`](https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback), [`del`](https://github.com/sindresorhus/del), and [`rimraf`](https://github.com/isaacs/rimraf) which permanently delete files, this only moves them to the trash, which is much safer and reversible. | ||
## CLI | ||
## Install | ||
``` | ||
$ npm install --global trash | ||
$ npm install --save trash | ||
``` | ||
``` | ||
$ trash --help | ||
Usage | ||
$ trash <path> [<path> ...] | ||
## Usage | ||
Example | ||
$ trash unicorn.png rainbow.png | ||
``` | ||
*Globbing support is left up to your shell, but `$ trash *.png` should expand to the above in most shells.* | ||
## API | ||
``` | ||
$ npm install --save trash | ||
``` | ||
```js | ||
var trash = require('trash'); | ||
const trash = require('trash'); | ||
trash(['unicorn.png', 'rainbow.png'], function (err) { | ||
trash(['unicorn.png', 'rainbow.png']).then(() => { | ||
console.log('done'); | ||
@@ -49,14 +32,9 @@ }); | ||
On OS X [`osx-trash`](https://github.com/sindresorhus/osx-trash) is used. | ||
On OS X, [`osx-trash`](https://github.com/sindresorhus/osx-trash) is used. | ||
On Linux [`xdg-trash`](https://github.com/kevva/xdg-trash) is used. | ||
On Linux, [`xdg-trash`](https://github.com/kevva/xdg-trash) is used. | ||
On Windows [`cmdutils`](http://www.maddogsw.com/cmdutils/) is used. | ||
On Windows, [`cmdutils`](http://www.maddogsw.com/cmdutils/) is used. | ||
## Tip | ||
Add `alias t=trash` to your `.zshrc`/`.bashrc` to reduce typing: `$ t unicorn.png`. | ||
## FAQ | ||
@@ -66,3 +44,3 @@ | ||
Not really. The `mv` command isn't cross-platform and moving to trash is not just about moving the file to a "trash" directory. On all OSes you'll run into file conflicts. The user won't easily be able to restore the file. It won't work on an external drive. The trash directory location varies between Windows versions. For Linux there's a whole [spec](http://www.ramendik.ru/docs/trashspec.html) you need to follow. On OS X you'll loose the [Put back](http://mac-fusion.com/trash-tip-how-to-put-files-back-to-their-original-location/) feature. | ||
Not really. The `mv` command isn't cross-platform and moving to trash is not just about moving the file to a "trash" directory. On all OSes you'll run into file conflicts. The user won't easily be able to restore the file. It won't work on an external drive. The trash directory location varies between Windows versions. For Linux, there's a whole [spec](http://www.ramendik.ru/docs/trashspec.html) you need to follow. On OS X, you'll lose the [Put back](http://mac-fusion.com/trash-tip-how-to-put-files-back-to-their-original-location/) feature. | ||
@@ -72,3 +50,5 @@ | ||
See [`empty-trash`](https://github.com/sindresorhus/empty-trash) for emptying the trash. | ||
- [trash-cli](https://github.com/sindresorhus/trash-cli) - CLI for this module | ||
- [empty-trash](https://github.com/sindresorhus/empty-trash) - Empty the trash | ||
- [del](https://github.com/sindresorhus/del) - Delete files/folders using globs | ||
@@ -75,0 +55,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
4151
4
4
8
56
1
+ Added@sindresorhus/df@2.1.0(transitive)
+ Addedcross-spawn-async@2.2.5(transitive)
+ Addedexeca@0.2.2(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmount-point@3.0.0(transitive)
+ Addednpm-run-path@1.0.0(transitive)
+ Addedosx-trash@2.0.0(transitive)
+ Addedpath-key@1.0.0(transitive)
+ Addedpinkie@1.0.0(transitive)
+ Addedpinkie-promise@1.0.0(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedrun-applescript@2.1.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addeduser-home@2.0.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwin-trash@2.0.0(transitive)
+ Addedxdg-basedir@2.0.0(transitive)
+ Addedxdg-trash@2.0.2(transitive)
+ Addedxdg-trashdir@2.1.1(transitive)
+ Addedyallist@2.1.2(transitive)
- Removedeach-async@^1.1.1
- Removedmeow@^3.0.0
- Removedpath-exists@^1.0.0
- Removedupdate-notifier@^0.3.0
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedarray-find-index@1.0.2(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcamelcase-keys@2.1.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedconfigstore@0.3.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removedduplexify@3.7.1(transitive)
- Removedeach-async@1.1.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesprima@4.0.1(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedgot@3.3.1(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedindent-string@2.1.0(transitive)
- Removedinfinity-agent@2.0.3(transitive)
- Removedini@1.3.8(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-npm@1.0.0(transitive)
- Removedis-redirect@1.0.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedlatest-version@1.0.1(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedlowercase-keys@1.0.1(transitive)
- Removedmap-obj@1.0.1(transitive)
- Removedmeow@3.7.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmount-point@1.2.0(transitive)
- Removednested-error-stacks@1.0.2(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedobject-assign@2.1.13.0.0(transitive)
- Removedonetime@1.1.0(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedosx-trash@1.0.1(transitive)
- Removedpackage-json@1.2.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@1.0.02.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedprepend-http@1.0.4(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedrc@1.2.8(transitive)
- Removedread-all-stream@3.1.0(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedredent@1.0.0(transitive)
- Removedregistry-url@3.1.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedrun-applescript@1.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsemver-diff@2.1.0(transitive)
- Removedset-immediate-shim@1.0.1(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedstring-length@1.0.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedstrip-indent@1.0.1(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtimed-out@2.0.0(transitive)
- Removedtrim-newlines@1.0.0(transitive)
- Removedupdate-notifier@0.3.2(transitive)
- Removeduser-home@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwin-trash@1.0.1(transitive)
- Removedxdg-basedir@1.0.1(transitive)
- Removedxdg-trash@1.1.0(transitive)
- Removedxdg-trashdir@1.1.1(transitive)
Updatedosx-trash@^2.0.0
Updatedwin-trash@^2.0.0
Updatedxdg-trash@^2.0.1