Skip to content

Commit

Permalink
fix #250: introduce tmpdir option for overriding the system tmp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
silkentrance committed Apr 28, 2020
1 parent 16acc7a commit 00877fa
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 48 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

## tmp v0.2.1

- [#250](https://github.com/raszi/node-tmp/issues/250)

***FEATURE***

New option `tmpdir` that allows users to override the system's tmpdir.

```
tmp.dirSync({tmpdir: '/mnt/tmp'});
```

## tmp v0.2.0

- drop support for node version < v8.17.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ All options are optional :)
absolute paths are fine as long as they point to a location under the system's default temporary directory.
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
as tmp will not check the availability of the path, nor will it establish the requested path for you.
* `tmpdir`: allows you to override the system's root tmp directory
* `tries`: how many times should the function try to get a unique filename before giving up, default `3`
* `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
* In order to clean up, you will have to call the provided `cleanupCallback` function manually.
Expand Down
67 changes: 49 additions & 18 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line191">line 191</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line192">line 192</a>
</li></ul></dd>


Expand Down Expand Up @@ -388,7 +388,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line219">line 219</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line220">line 220</a>
</li></ul></dd>


Expand Down Expand Up @@ -628,7 +628,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line126">line 126</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line127">line 127</a>
</li></ul></dd>


Expand Down Expand Up @@ -765,7 +765,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line164">line 164</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line165">line 165</a>
</li></ul></dd>


Expand Down Expand Up @@ -908,7 +908,7 @@ <h4 class="name" id="setGracefulCleanup"><span class="type-signature"></span>set

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line630">line 630</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line655">line 655</a>
</li></ul></dd>


Expand Down Expand Up @@ -1434,7 +1434,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line713">line 713</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line739">line 739</a>
</li></ul></dd>


Expand Down Expand Up @@ -1522,7 +1522,7 @@ <h4 class="name" id="cleanupCallbackSync"><span class="type-signature"></span>cl

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line720">line 720</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line746">line 746</a>
</li></ul></dd>


Expand Down Expand Up @@ -1729,7 +1729,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line699">line 699</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line725">line 725</a>
</li></ul></dd>


Expand Down Expand Up @@ -1936,7 +1936,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line706">line 706</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line732">line 732</a>
</li></ul></dd>


Expand Down Expand Up @@ -2093,7 +2093,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line671">line 671</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line697">line 697</a>
</li></ul></dd>


Expand Down Expand Up @@ -2317,7 +2317,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line683">line 683</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line709">line 709</a>
</li></ul></dd>


Expand Down Expand Up @@ -2555,7 +2555,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line691">line 691</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line717">line 717</a>
</li></ul></dd>


Expand Down Expand Up @@ -2735,7 +2735,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line664">line 664</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line690">line 690</a>
</li></ul></dd>


Expand Down Expand Up @@ -2978,7 +2978,7 @@ <h5 class="subsection-title">Properties:</h5>



<td class="description last">tmp directory relative to the system tmp directory to use</td>
<td class="description last">tmp directory relative to the root tmp directory in use</td>
</tr>


Expand Down Expand Up @@ -3045,6 +3045,37 @@ <h5 class="subsection-title">Properties:</h5>



<tr>

<td class="name"><code>tmpdir</code></td>


<td class="type">


<span class="param-type">string</span>



</td>


<td class="attributes">



&lt;nullable><br>

</td>




<td class="description last">the root tmp directory which overrides the os tmpdir</td>
</tr>



<tr>

<td class="name"><code>unsafeCleanup</code></td>
Expand Down Expand Up @@ -3172,7 +3203,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line647">line 647</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line672">line 672</a>
</li></ul></dd>


Expand Down Expand Up @@ -3246,7 +3277,7 @@ <h4 class="name" id="simpleCallback"><span class="type-signature"></span>simpleC

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line726">line 726</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line752">line 752</a>
</li></ul></dd>


Expand Down Expand Up @@ -3429,7 +3460,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line677">line 677</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line703">line 703</a>
</li></ul></dd>


Expand Down Expand Up @@ -3479,7 +3510,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Feb 08 2020 01:04:48 GMT+0100 (GMT+01:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Apr 28 2020 19:27:57 GMT+0200 (GMT+02:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
3 changes: 2 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ <h2>Options</h2>
absolute paths are fine as long as they point to a location under the system's default temporary directory.
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
as tmp will not check the availability of the path, nor will it establish the requested path for you.</li>
<li><code>tmpdir</code>: allows you to override the system's root tmp directory</li>
<li><code>tries</code>: how many times should the function try to get a unique filename before giving up, default <code>3</code></li>
<li><code>keep</code>: signals that the temporary file or directory should not be deleted on exit, default is <code>false</code>
<ul>
Expand All @@ -322,7 +323,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sat Feb 08 2020 01:04:48 GMT+0100 (GMT+01:00)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Apr 28 2020 19:27:57 GMT+0200 (GMT+02:00)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 00877fa

Please sign in to comment.