Socket
Socket
Sign inDemoInstall

create-temp-directory

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    create-temp-directory

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


Version published
Weekly downloads
3.1K
increased by6.84%
Maintainers
1
Install size
9.42 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 26 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc