Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
silkentrance committed Aug 26, 2022
1 parent 2160076 commit da08266
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 49 deletions.
26 changes: 13 additions & 13 deletions docs/global.html
Original file line number Diff line number Diff line change
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#line654">line 654</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line639">line 639</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#line739">line 739</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line724">line 724</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#line746">line 746</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line731">line 731</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#line725">line 725</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line710">line 710</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#line732">line 732</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 @@ -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#line697">line 697</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line682">line 682</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#line709">line 709</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line694">line 694</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#line717">line 717</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line702">line 702</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#line690">line 690</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line675">line 675</a>
</li></ul></dd>


Expand Down Expand Up @@ -3203,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#line672">line 672</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line657">line 657</a>
</li></ul></dd>


Expand Down Expand Up @@ -3277,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#line752">line 752</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line737">line 737</a>
</li></ul></dd>


Expand Down Expand Up @@ -3460,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#line703">line 703</a>
<a href="tmp.js.html">tmp.js</a>, <a href="tmp.js.html#line688">line 688</a>
</li></ul></dd>


Expand Down Expand Up @@ -3510,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 Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
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)
</footer>

<script> prettyPrint(); </script>
Expand Down
38 changes: 23 additions & 15 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,21 @@ <h2>About</h2>
not.</p>
<p>If you do not want to store your temporary directories and files in the
standard OS temporary directory, then you are free to override that as well.</p>
<h2>An Important Note on Previously Undocumented Breaking Changes</h2>
<p>All breaking changes that had been introduced, i.e.</p>
<ul>
<li>tmpdir must be located under the system defined tmpdir root.</li>
<li>Spaces being collapsed into single spaces</li>
<li>Removal of all single and double quote characters</li>
</ul>
<p>have been reverted in v0.2.2 and tmp should now behave as it did before the
introduction of these breaking changes.</p>
<p>In order to override the system's tmpdir, you will have to use the newly
introduced tmpdir option.</p>
<h2>An Important Note on Compatibility</h2>
<p>See the <a href="./CHANGELOG.md">CHANGELOG</a> for more information.</p>
<h3>Version 0.2.2</h3>
<p>Since version 0.2.2, all support for node version &lt; 12 has been dropped.</p>
<h3>Version 0.1.0</h3>
<p>Since version 0.1.0, all support for node versions &lt; 0.10.0 has been dropped.</p>
<p>Most importantly, any support for earlier versions of node-tmp was also dropped.</p>
Expand All @@ -81,6 +94,13 @@ <h2>How to install</h2>
</code></pre>
<h2>Usage</h2>
<p>Please also check <a href="https://raszi.github.io/node-tmp/">API docs</a>.</p>
<h2>Graceful cleanup</h2>
<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>
<p>To enforce this, you can call the <code>setGracefulCleanup()</code> method:</p>
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');

tmp.setGracefulCleanup();
</code></pre>
<h3>Asynchronous file creation</h3>
<p>Simple temporary file creation, the file will be closed and unlinked on process exit.</p>
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');
Expand Down Expand Up @@ -271,27 +291,15 @@ <h3>Synchronous filename generation</h3>
const tmpname = tmp.tmpNameSync(options);
console.log('Created temporary filename: ', tmpname);
</code></pre>
<h2>Graceful cleanup</h2>
<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>
<p>To enforce this, you can call the <code>setGracefulCleanup()</code> method:</p>
<pre class="prettyprint source lang-javascript"><code>const tmp = require('tmp');

tmp.setGracefulCleanup();
</code></pre>
<h2>Options</h2>
<p>All options are optional :)</p>
<ul>
<li><code>name</code>: a fixed name that overrides random name generation, the name must be relative and must not contain path segments</li>
<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>
<li><code>prefix</code>: the optional prefix, defaults to <code>tmp</code></li>
<li><code>postfix</code>: the optional postfix</li>
<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
to a relative path of the system's default temporary directory, must include <code>XXXXXX</code> once for random name generation, e.g.
'foo/bar/XXXXXX'. Absolute paths are also fine as long as they are relative to os.tmpdir().
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>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.
'foo-bar-XXXXXX'.</li>
<li><code>dir</code>: the optional temporary directory that must be relative to the system's default temporary directory.
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,
Expand Down Expand Up @@ -323,7 +331,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 Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
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)
</footer>

<script> prettyPrint(); </script>
Expand Down
27 changes: 6 additions & 21 deletions docs/tmp.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ <h1 class="page-title">Source: tmp.js</h1>
options.template = _isBlank(options.template) ? undefined : path.relative(options.dir, options.template);

// for completeness' sake only, also keep (multiple) blanks if the user, purportedly sane, requests us to
options.name = _isUndefined(options.name) ? undefined : _sanitizeName(options.name);
options.name = _isUndefined(options.name) ? undefined : options.name;
options.prefix = _isUndefined(options.prefix) ? '' : options.prefix;
options.postfix = _isUndefined(options.postfix) ? '' : options.postfix;
}
Expand All @@ -580,28 +580,13 @@ <h1 class="page-title">Source: tmp.js</h1>
* @private
*/
function _resolvePath(name, tmpDir) {
const sanitizedName = _sanitizeName(name);
if (sanitizedName.startsWith(tmpDir)) {
return path.resolve(sanitizedName);
if (name.startsWith(tmpDir)) {
return path.resolve(name);
} else {
return path.resolve(path.join(tmpDir, sanitizedName));
return path.resolve(path.join(tmpDir, name));
}
}

/**
* Sanitize the specified path name by removing all quote characters.
*
* @param name
* @returns {string}
* @private
*/
function _sanitizeName(name) {
if (_isBlank(name)) {
return name;
}
return name.replace(/["']/g, '');
}

/**
* Asserts whether specified name is relative to the specified tmpDir.
*
Expand Down Expand Up @@ -691,7 +676,7 @@ <h1 class="page-title">Source: tmp.js</h1>
* @returns {string} the currently configured tmp dir
*/
function _getTmpDir(options) {
return path.resolve(_sanitizeName(options &amp;&amp; options.tmpdir || os.tmpdir()));
return path.resolve(options &amp;&amp; options.tmpdir || os.tmpdir());
}

// Install process exit listener
Expand Down Expand Up @@ -822,7 +807,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 Tue Apr 28 2020 21:12:13 GMT+0200 (GMT+02:00)
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)
</footer>

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

0 comments on commit da08266

Please sign in to comment.