1.1.2 • Published 4 months ago

@nielse63/trash v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@nielse63/trash

Move files to trash (instead of rm -rf)

npm (scoped) npm GitHub issues by-label

Installation

npm install --save @nielse63/trash

Usage

CLI

$ trash --help

Usage: trash [options] <arguments>

Move files to trash (instead of rm -rf)

Arguments:
  ...

Options:
  -V, --version  output the version number
  -h, --help     display help for command

API

import trash from '@nielse63/trash';

const results = await trash(['file.md', 'directory'], {
  cwd: process.cwd(),
  trash: path.join(os.homedir(), '.Trash'),
});

// results:
// [
//   {
//     "old": "/path/to/file.md",
//     "new": "/Users/username/.Trash/file_1691311838573_dUGBD6dd.md"
//   },
//   {
//     "old": "/path/to/directory",
//     "new": "/Users/username/.Trash/directory_1691311838573_nsRcsJWf"
//   }
// ]