Socket
Socket
Sign inDemoInstall

trash

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trash - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

12

index.js
'use strict';
const fs = require('fs');
const path = require('path');
const pathExists = require('path-exists');
const globby = require('globby');

@@ -9,7 +9,9 @@ const macos = require('./lib/macos');

module.exports = iterable => {
iterable = typeof iterable === 'string' ? [iterable] : iterable;
const paths = globby.sync(Array.from(iterable).map(String), {nonull: true})
module.exports = (iterable, opts) => {
iterable = Array.from(typeof iterable === 'string' ? [iterable] : iterable).map(String);
opts = Object.assign({glob: true}, opts);
const paths = (opts.glob === false ? iterable : globby.sync(iterable, {nonull: true}))
.map(x => path.resolve(x))
.filter(pathExists.sync);
.filter(fs.existsSync);

@@ -16,0 +18,0 @@ if (paths.length === 0) {

@@ -11,3 +11,3 @@ 'use strict';

// binary source: https://github.com/sindresorhus/macos-trash
// Binary source: https://github.com/sindresorhus/macos-trash
const bin = path.join(__dirname, 'macos-trash');

@@ -14,0 +14,0 @@

@@ -6,5 +6,5 @@ 'use strict';

// binary source: https://github.com/sindresorhus/recycle-bin
// Binary source: https://github.com/sindresorhus/recycle-bin
const bin = path.join(__dirname, 'win-trash.exe');
module.exports = paths => pify(execFile)(bin, paths);
{
"name": "trash",
"version": "4.0.1",
"description": "Move files and folders to the trash",
"license": "MIT",
"repository": "sindresorhus/trash",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"lib"
],
"keywords": [
"trash",
"recycle",
"bin",
"rm",
"rmrf",
"rimraf",
"remove",
"delete",
"del",
"file",
"files",
"dir",
"directory",
"directories",
"folder",
"folders",
"xdg"
],
"dependencies": {
"escape-string-applescript": "^1.0.0",
"fs-extra": "^0.30.0",
"globby": "^6.0.0",
"path-exists": "^3.0.0",
"pify": "^2.3.0",
"run-applescript": "^3.0.0",
"uuid": "^2.0.1",
"xdg-trashdir": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"tempfile": "^1.1.1",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "trash",
"version": "4.1.0",
"description": "Move files and folders to the trash",
"license": "MIT",
"repository": "sindresorhus/trash",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"lib"
],
"keywords": [
"trash",
"recycle",
"bin",
"rm",
"rmrf",
"rimraf",
"remove",
"delete",
"del",
"file",
"files",
"dir",
"directory",
"directories",
"folder",
"folders",
"xdg"
],
"dependencies": {
"escape-string-applescript": "^2.0.0",
"fs-extra": "^0.30.0",
"globby": "^6.0.0",
"pify": "^3.0.0",
"run-applescript": "^3.0.0",
"uuid": "^3.1.0",
"xdg-trashdir": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"tempfile": "^2.0.0",
"xo": "*"
}
}

@@ -15,3 +15,3 @@ # ![trash](https://cdn.rawgit.com/sindresorhus/trash/1cdbd660976d739eeb45447bb6b62c41ac4a3ecf/media/logo.svg)

```
$ npm install --save trash
$ npm install trash
```

@@ -30,5 +30,6 @@

## API
### trash(input)
### trash(input, [options])

@@ -43,3 +44,14 @@ Returns a `Promise`.

#### options
Type: `Object`
##### glob
Type: `boolean`<br>
Default: `true`
Enable globbing when matching file paths.
## CLI

@@ -46,0 +58,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc