UNPKG

1.06 kBMarkdownView Raw
1# node-quick-temp
2
3Create and remove temporary directories. Useful for build tools, like Broccoli
4plugins. Smart about naming, and placing them in `./tmp` if possible, so you
5don't have to worry about this.
6
7## Installation
8
9```bash
10npm install --save quick-temp
11```
12
13## Usage
14
15```js
16var quickTemp = require('quick-temp')
17```
18
19### Creating a temporary directory
20
21To make a temporary and assign its path to `this.tmpDestDir`, call either one
22of these:
23
24```js
25quickTemp.makeOrRemake(this, 'tmpDestDir')
26// or
27quickTemp.makeOrReuse(this, 'tmpDestDir')
28```
29
30If `this.tmpDestDir` already contains a path, `makeOrRemake` will remove it
31first and then create a new directory, whereas `makeOrReuse` will be a no-op.
32
33Both functions also return the path of the temporary directory.
34
35### Removing a temporary directory
36
37To remove a previously-created temporary directory and all its contents, call
38
39```js
40quickTemp.remove(this, 'tmpDestDir')
41```
42
43This will also assign `this.tmpDestDir = null`. If `this.tmpDestDir` is
44already null or undefined, it will be a no-op.