xdg-trashdir-fixed

Get the correct trash path on Linux

Usage no npm install needed!

<script type="module">
  import xdgTrashdirFixed from 'https://cdn.skypack.dev/xdg-trashdir-fixed';
</script>

README

xdg-trashdir Build Status

Get the correct trash path on Linux according to the spec

Install

$ npm install --save xdg-trashdir

Usage

const xdgTrashdir = require('xdg-trashdir');

xdgTrashdir().then(dir => {
    console.log(dir);
    //=> '/home/johndoe/.local/share/Trash'
});

xdgTrashdir('foo.zip').then(dir => {
    console.log(dir);
    //=> '/media/johndoe/UUI/.Trash-1000'
});

xdgTrashdir.all().then(dirs => {
    console.log(dirs);
    //=> ['/home/johndoe/.local/share/Trash', '/media/johndoe/UUI/.Trash-1000', ...]
});

API

xdgTrashdir([file])

Returns a promise that resolves the path to the trash.

file

Type: string

Get the trash path for a specific file.

xdgTrashdir.all()

Returns a promise that resolves to an array with all possible trash paths.

License

MIT © Kevin Mårtensson