disposable-directory

Asynchronously creates a disposable directory in the OS temporary directory that gets deleted after the callback is done or errors.

Usage no npm install needed!

<script type="module">
  import disposableDirectory from 'https://cdn.skypack.dev/disposable-directory';
</script>

README

disposable-directory

npm version CI status

Asynchronously creates a disposable directory in the OS temporary directory that gets deleted after the callback is done or errors.

Installation

To install with npm, run:

npm install disposable-directory

Examples

How to use a disposable directory:

import disposableDirectory from "disposable-directory";

disposableDirectory(async (directoryPath) => {
  // Use the directory here.
})
  .then(() => {
    // The directory is gone.
  })
  .catch(() => {
    // The directory is gone.
  });

Requirements

  • Operating system:
    • Linux
    • macOS
  • Node.js: ^12.22.0 || ^14.17.0 || >= 16.0.0

Exports

These ECMAScript modules are published to npm and exported via the package.json exports field: