mkdirtemp

1.1.0 • Public • Published

mkdirtemp Build status for mkdirtemp on Circle CI.

Create a unique temporary directory.

Why?

  • Fixes the awkward fs.mkdtemp() API.
  • Supports async and await.
  • Sensible defaults.

Install

npm install mkdirtemp --save

Usage

Get it into your program.

const mkdirtemp = require('mkdirtemp');

Make a new and unique temporary directory.

mkdirtemp().then((dirPath) => {
   console.log(dirPath);
   // => /var/folders/gr/qfsxs2gj0fq1ypdsfd8rj8tr0000gn/T/MKufpq
});

API

mkdirtemp(cwd)

Returns a Promise for the path of the new directory.

cwd

Type: string
Default: os.tmpdir()

Parent of the new directory once it is created.

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.

Package Sidebar

Install

npm i mkdirtemp

Weekly Downloads

1,481

Version

1.1.0

License

MPL-2.0

Last publish

Collaborators

  • sholladay