diff --git a/index.d.ts b/index.d.ts index 6548c4c..9356fff 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function trash( - // input: string | string[], - // options?: Options - // ): Promise; - // export = trash; - default: typeof trash; -}; +(async () => { + await trash(['*.png', '!rainbow.png']); +})(); +``` +*/ +declare function trash( + input: string | readonly string[], + options?: trash.Options +): Promise; export = trash; diff --git a/index.js b/index.js index 2d6d12f..a93d393 100644 --- a/index.js +++ b/index.js @@ -57,5 +57,3 @@ const trash = (paths, options) => pTry(() => { }); module.exports = trash; -// TODO: Remove this for the next major release -module.exports.default = trash; diff --git a/lib/win-trash.exe b/lib/win-trash.exe deleted file mode 100644 index f3fa69c..0000000 Binary files a/lib/win-trash.exe and /dev/null differ diff --git a/lib/windows-trash.exe b/lib/windows-trash.exe new file mode 100644 index 0000000..69e8ee1 Binary files /dev/null and b/lib/windows-trash.exe differ diff --git a/lib/windows.js b/lib/windows.js index 5676714..3fb3b71 100644 --- a/lib/windows.js +++ b/lib/windows.js @@ -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); diff --git a/package.json b/package.json index a493b89..43deb93 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } diff --git a/readme.md b/readme.md index 371909b..b6bacc7 100644 --- a/readme.md +++ b/readme.md @@ -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.