Skip to content

Commit da08266

Browse files
committed
update docs
1 parent 2160076 commit da08266

File tree

3 files changed

+42
-49
lines changed

3 files changed

+42
-49
lines changed

docs/global.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ <h4 class="name" id="setGracefulCleanup"><span class="type-signature"></span>set
908908

909909
<dt class="tag-source">Source:</dt>
910910
<dd class="tag-source"><ul class="dummy"><li>
911-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line654">line 654</a>
911+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line639">line 639</a>
912912
</li></ul></dd>
913913

914914

@@ -1434,7 +1434,7 @@ <h5>Parameters:</h5>
14341434

14351435
<dt class="tag-source">Source:</dt>
14361436
<dd class="tag-source"><ul class="dummy"><li>
1437-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line739">line 739</a>
1437+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line724">line 724</a>
14381438
</li></ul></dd>
14391439

14401440

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

15231523
<dt class="tag-source">Source:</dt>
15241524
<dd class="tag-source"><ul class="dummy"><li>
1525-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line746">line 746</a>
1525+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line731">line 731</a>
15261526
</li></ul></dd>
15271527

15281528

@@ -1729,7 +1729,7 @@ <h5>Parameters:</h5>
17291729

17301730
<dt class="tag-source">Source:</dt>
17311731
<dd class="tag-source"><ul class="dummy"><li>
1732-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line725">line 725</a>
1732+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line710">line 710</a>
17331733
</li></ul></dd>
17341734

17351735

@@ -1936,7 +1936,7 @@ <h5>Parameters:</h5>
19361936

19371937
<dt class="tag-source">Source:</dt>
19381938
<dd class="tag-source"><ul class="dummy"><li>
1939-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line732">line 732</a>
1939+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line717">line 717</a>
19401940
</li></ul></dd>
19411941

19421942

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

20942094
<dt class="tag-source">Source:</dt>
20952095
<dd class="tag-source"><ul class="dummy"><li>
2096-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line697">line 697</a>
2096+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line682">line 682</a>
20972097
</li></ul></dd>
20982098

20992099

@@ -2317,7 +2317,7 @@ <h5>Parameters:</h5>
23172317

23182318
<dt class="tag-source">Source:</dt>
23192319
<dd class="tag-source"><ul class="dummy"><li>
2320-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line709">line 709</a>
2320+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line694">line 694</a>
23212321
</li></ul></dd>
23222322

23232323

@@ -2555,7 +2555,7 @@ <h5>Parameters:</h5>
25552555

25562556
<dt class="tag-source">Source:</dt>
25572557
<dd class="tag-source"><ul class="dummy"><li>
2558-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line717">line 717</a>
2558+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line702">line 702</a>
25592559
</li></ul></dd>
25602560

25612561

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

27362736
<dt class="tag-source">Source:</dt>
27372737
<dd class="tag-source"><ul class="dummy"><li>
2738-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line690">line 690</a>
2738+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line675">line 675</a>
27392739
</li></ul></dd>
27402740

27412741

@@ -3203,7 +3203,7 @@ <h5 class="subsection-title">Properties:</h5>
32033203

32043204
<dt class="tag-source">Source:</dt>
32053205
<dd class="tag-source"><ul class="dummy"><li>
3206-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line672">line 672</a>
3206+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line657">line 657</a>
32073207
</li></ul></dd>
32083208

32093209

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

32783278
<dt class="tag-source">Source:</dt>
32793279
<dd class="tag-source"><ul class="dummy"><li>
3280-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line752">line 752</a>
3280+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line737">line 737</a>
32813281
</li></ul></dd>
32823282

32833283

@@ -3460,7 +3460,7 @@ <h5>Parameters:</h5>
34603460

34613461
<dt class="tag-source">Source:</dt>
34623462
<dd class="tag-source"><ul class="dummy"><li>
3463-
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line703">line 703</a>
3463+
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line688">line 688</a>
34643464
</li></ul></dd>
34653465

34663466

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

35123512
<footer>
3513-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
3513+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Aug 26 2022 21:08:17 GMT+0200 (Mitteleuropäische Sommerzeit)
35143514
</footer>
35153515

35163516
<script> prettyPrint(); </script>

docs/index.html

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,21 @@ <h2>About</h2>
6363
not.</p>
6464
<p>If you do not want to store your temporary directories and files in the
6565
standard OS temporary directory, then you are free to override that as well.</p>
66+
<h2>An Important Note on Previously Undocumented Breaking Changes</h2>
67+
<p>All breaking changes that had been introduced, i.e.</p>
68+
<ul>
69+
<li>tmpdir must be located under the system defined tmpdir root.</li>
70+
<li>Spaces being collapsed into single spaces</li>
71+
<li>Removal of all single and double quote characters</li>
72+
</ul>
73+
<p>have been reverted in v0.2.2 and tmp should now behave as it did before the
74+
introduction of these breaking changes.</p>
75+
<p>In order to override the system's tmpdir, you will have to use the newly
76+
introduced tmpdir option.</p>
6677
<h2>An Important Note on Compatibility</h2>
6778
<p>See the <a href="./CHANGELOG.md">CHANGELOG</a> for more information.</p>
79+
<h3>Version 0.2.2</h3>
80+
<p>Since version 0.2.2, all support for node version &lt; 12 has been dropped.</p>
6881
<h3>Version 0.1.0</h3>
6982
<p>Since version 0.1.0, all support for node versions &lt; 0.10.0 has been dropped.</p>
7083
<p>Most importantly, any support for earlier versions of node-tmp was also dropped.</p>
@@ -81,6 +94,13 @@ <h2>How to install</h2>
8194
</code></pre>
8295
<h2>Usage</h2>
8396
<p>Please also check <a href="https://raszi.github.io/node-tmp/">API docs</a>.</p>
97+
<h2>Graceful cleanup</h2>
98+
<p>If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary object removal.</p>
99+
<p>To enforce this, you can call the <code>setGracefulCleanup()</code> method:</p>
100+
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');
101+
102+
tmp.setGracefulCleanup();
103+
</code></pre>
84104
<h3>Asynchronous file creation</h3>
85105
<p>Simple temporary file creation, the file will be closed and unlinked on process exit.</p>
86106
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');
@@ -271,27 +291,15 @@ <h3>Synchronous filename generation</h3>
271291
const tmpname = tmp.tmpNameSync(options);
272292
console.log('Created temporary filename: ', tmpname);
273293
</code></pre>
274-
<h2>Graceful cleanup</h2>
275-
<p>If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
276-
temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
277-
object removal.</p>
278-
<p>To enforce this, you can call the <code>setGracefulCleanup()</code> method:</p>
279-
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');
280-
281-
tmp.setGracefulCleanup();
282-
</code></pre>
283294
<h2>Options</h2>
284295
<p>All options are optional :)</p>
285296
<ul>
286297
<li><code>name</code>: a fixed name that overrides random name generation, the name must be relative and must not contain path segments</li>
287298
<li><code>mode</code>: the file mode to create with, falls back to <code>0o600</code> on file creation and <code>0o700</code> on directory creation</li>
288299
<li><code>prefix</code>: the optional prefix, defaults to <code>tmp</code></li>
289300
<li><code>postfix</code>: the optional postfix</li>
290-
<li><code>template</code>: <a href="http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html"><code>mkstemp</code></a> like filename template, no default, can be either an absolute or a relative path that resolves
291-
to a relative path of the system's default temporary directory, must include <code>XXXXXX</code> once for random name generation, e.g.
292-
'foo/bar/XXXXXX'. Absolute paths are also fine as long as they are relative to os.tmpdir().
293-
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
294-
as tmp will not check the availability of the path, nor will it establish the requested path for you.</li>
301+
<li><code>template</code>: <a href="http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html"><code>mkstemp</code></a> like filename template, no default, must include <code>XXXXXX</code> once for random name generation, e.g.
302+
'foo-bar-XXXXXX'.</li>
295303
<li><code>dir</code>: the optional temporary directory that must be relative to the system's default temporary directory.
296304
absolute paths are fine as long as they point to a location under the system's default temporary directory.
297305
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
@@ -323,7 +331,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
323331
<br class="clear">
324332

325333
<footer>
326-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
334+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Aug 26 2022 21:08:17 GMT+0200 (Mitteleuropäische Sommerzeit)
327335
</footer>
328336

329337
<script> prettyPrint(); </script>

docs/tmp.js.html

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ <h1 class="page-title">Source: tmp.js</h1>
563563
options.template = _isBlank(options.template) ? undefined : path.relative(options.dir, options.template);
564564

565565
// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
566-
options.name = _isUndefined(options.name) ? undefined : _sanitizeName(options.name);
566+
options.name = _isUndefined(options.name) ? undefined : options.name;
567567
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
568568
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
569569
}
@@ -580,28 +580,13 @@ <h1 class="page-title">Source: tmp.js</h1>
580580
* @private
581581
*/
582582
function _resolvePath(name, tmpDir) {
583-
const sanitizedName = _sanitizeName(name);
584-
if (sanitizedName.startsWith(tmpDir)) {
585-
return path.resolve(sanitizedName);
583+
if (name.startsWith(tmpDir)) {
584+
return path.resolve(name);
586585
} else {
587-
return path.resolve(path.join(tmpDir, sanitizedName));
586+
return path.resolve(path.join(tmpDir, name));
588587
}
589588
}
590589

591-
/**
592-
* Sanitize the specified path name by removing all quote characters.
593-
*
594-
* @param name
595-
* @returns {string}
596-
* @private
597-
*/
598-
function _sanitizeName(name) {
599-
if (_isBlank(name)) {
600-
return name;
601-
}
602-
return name.replace(/["']/g, '');
603-
}
604-
605590
/**
606591
* Asserts whether specified name is relative to the specified tmpDir.
607592
*
@@ -691,7 +676,7 @@ <h1 class="page-title">Source: tmp.js</h1>
691676
* @returns {string} the currently configured tmp dir
692677
*/
693678
function _getTmpDir(options) {
694-
return path.resolve(_sanitizeName(options &amp;&amp; options.tmpdir || os.tmpdir()));
679+
return path.resolve(options &amp;&amp; options.tmpdir || os.tmpdir());
695680
}
696681

697682
// Install process exit listener
@@ -822,7 +807,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
822807
<br class="clear">
823808

824809
<footer>
825-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
810+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Fri Aug 26 2022 21:08:17 GMT+0200 (Mitteleuropäische Sommerzeit)
826811
</footer>
827812

828813
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)