JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6514
  • Score
    100M100P100Q123681F
  • License MIT

Create an empty, unique directory in the current OS's temp directory

Package Exports

  • create-temp-directory
  • create-temp-directory/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (create-temp-directory) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

create-temp-directory

npm version tests

Create an empty, unique directory in the current OS's temp directory. It returns an absolute path and a remove() function. Useful for tests.

Getting started

Install the library as a devDependency in an existing project:

npm i create-temp-directory --save-dev

Example usage

import { createTempDirectory, ITempDirectory } from "create-temp-directory";

describe("test suite", () => {
  let tempDir: ITempDirectory;

  beforeEach(async () => {
    tempDir = await createTempDirectory();
  });
  afterEach(async () => {
    await tempDir.remove();
  });

  it("some test", () => {
    const tempFilePath = path.join(tempDir.path, "temp-file");
    // the rest of the test...
  });
});

NOTE: The above example is written using TypeScript. In pure JavaScript, you do not need to import/use ITempDirectory.

License

MIT