Skip to content

Commit

Permalink
Update Windows binary and other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 29, 2019
1 parent 08934d3 commit 8ec3260
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 28 deletions.
37 changes: 15 additions & 22 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,23 @@ declare namespace trash {
}
}

declare const trash: {
/**
Move files and folders to the trash.
/**
Move files and folders to the trash.
@param input - Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param input - Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@example
```
import trash = require('trash');
@example
```
import trash = require('trash');
(async () => {
await trash(['*.png', '!rainbow.png']);
})();
```
*/
(input: string | string[], options?: trash.Options): Promise<void>;

// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function trash(
// input: string | string[],
// options?: Options
// ): Promise<void>;
// export = trash;
default: typeof trash;
};
(async () => {
await trash(['*.png', '!rainbow.png']);
})();
```
*/
declare function trash(
input: string | readonly string[],
options?: trash.Options
): Promise<void>;

export = trash;
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ const trash = (paths, options) => pTry(() => {
});

module.exports = trash;
// TODO: Remove this for the next major release
module.exports.default = trash;
Binary file removed lib/win-trash.exe
Binary file not shown.
Binary file added lib/windows-trash.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {execFile} = require('child_process');
const pExecFile = promisify(execFile);

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

module.exports = async paths => {
await pExecFile(binary, paths);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"escape-string-applescript": "^2.0.0",
"globby": "^7.1.1",
"is-path-inside": "^2.0.0",
"make-dir": "^1.3.0",
"make-dir": "^3.0.0",
"move-file": "^1.1.0",
"p-map": "^2.0.0",
"p-try": "^2.2.0",
Expand All @@ -53,7 +53,7 @@
},
"devDependencies": {
"ava": "^1.4.1",
"tempfile": "^2.0.0",
"tempfile": "^3.0.0",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash)

Works on macOS, Linux, and Windows.
Works on macOS, Linux, and Windows (8 or later).

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.

Expand Down

0 comments on commit 8ec3260

Please sign in to comment.