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