unique-temp-dir
Provides a uniquely named temp directory.
Install
$ npm install --save unique-temp-dir
Usage
const uniqueTempDir = require('unique-temp-dir');
uniqueTempDir();
uniqueTempDir();
API
uniqueTempDir([options])
Returns a string that represents a unique directory inside the systems temp directory.
options
create
Type: boolean
Default: false
If true
, the directory will be created synchronously before returning.
length
Type: number
Default: 20
The length of the directory name inside the temp directory.
thunk
Type: boolean
Default: false
If true, returns a thunk function for path.join(uniqueTempDir, ... additionalArgs)
. Useful for filling your directory up with stuff.
const uniqueTempDir = require('unique-temp-dir');
const tempDir = uniqueTempDir({thunk: true});
tempDir()
tempDir('foo')
tempDir('bar')
License
MIT © James Talmage