tmp
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -538,3 +538,3 @@ /*! | ||
// 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; | ||
@@ -556,7 +556,6 @@ options.postfix = _isUndefined(options.postfix) ? '' : options.postfix; | ||
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)); | ||
} | ||
@@ -566,16 +565,2 @@ } | ||
/** | ||
* 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. | ||
@@ -669,3 +654,3 @@ * | ||
function _getTmpDir(options) { | ||
return path.resolve(_sanitizeName(options && options.tmpdir || os.tmpdir())); | ||
return path.resolve(options && options.tmpdir || os.tmpdir()); | ||
} | ||
@@ -672,0 +657,0 @@ |
{ | ||
"name": "tmp", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Temporary file and directory creator", | ||
@@ -25,6 +25,6 @@ "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", | ||
"engines": { | ||
"node": ">=8.17.0" | ||
"node": ">=14" | ||
}, | ||
"dependencies": { | ||
"rimraf": "^3.0.0" | ||
"rimraf": "^5.0.5" | ||
}, | ||
@@ -36,3 +36,3 @@ "devDependencies": { | ||
"lerna-changelog": "^1.0.1", | ||
"mocha": "^6.2.0" | ||
"mocha": "^10.2.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "main": "lib/tmp.js", |
@@ -5,4 +5,4 @@ # Tmp | ||
[![Build Status](https://travis-ci.org/raszi/node-tmp.svg?branch=master)](https://travis-ci.org/raszi/node-tmp) | ||
[![Dependencies](https://david-dm.org/raszi/node-tmp.svg)](https://david-dm.org/raszi/node-tmp) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/raszi/node-tmp/node.js.yml?branch=master)](https://github.com/raszi/node-tmp/actions/workflows/node.js.yml) | ||
[![Dependencies](https://img.shields.io/librariesio/github/raszi/node-tmp)](https://libraries.io/github/raszi/node-tmp) | ||
[![npm version](https://badge.fury.io/js/tmp.svg)](https://badge.fury.io/js/tmp) | ||
@@ -31,2 +31,24 @@ [![API documented](https://img.shields.io/badge/API-documented-brightgreen.svg)](https://raszi.github.io/node-tmp/) | ||
## An Important Note on Previously Undocumented Breaking Changes | ||
All breaking changes that had been introduced, i.e. | ||
- tmpdir must be located under the system defined tmpdir root. | ||
- Spaces being collapsed into single spaces | ||
- Removal of all single and double quote characters | ||
have been reverted in v0.2.2 and tmp should now behave as it did before the | ||
introduction of these breaking changes. | ||
Other breaking changes, i.e. | ||
- template must be relative to tmpdir | ||
- name must be relative to tmpdir | ||
- dir option must be relative to tmpdir | ||
are still in place. | ||
In order to override the system's tmpdir, you will have to use the newly | ||
introduced tmpdir option. | ||
## An Important Note on Compatibility | ||
@@ -36,2 +58,6 @@ | ||
### Version 0.2.2 | ||
Since version 0.2.2, all support for node version <= 12 has been dropped. | ||
### Version 0.1.0 | ||
@@ -66,2 +92,14 @@ | ||
## Graceful cleanup | ||
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. | ||
To enforce this, you can call the `setGracefulCleanup()` method: | ||
```javascript | ||
const tmp = require('tmp'); | ||
tmp.setGracefulCleanup(); | ||
``` | ||
### Asynchronous file creation | ||
@@ -326,16 +364,2 @@ | ||
## Graceful cleanup | ||
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. | ||
To enforce this, you can call the `setGracefulCleanup()` method: | ||
```javascript | ||
const tmp = require('tmp'); | ||
tmp.setGracefulCleanup(); | ||
``` | ||
## Options | ||
@@ -349,7 +373,4 @@ | ||
* `postfix`: the optional postfix | ||
* `template`: [`mkstemp`][3] 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 `XXXXXX` 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. | ||
* `template`: [`mkstemp`][3] like filename template, no default, must include `XXXXXX` once for random name generation, e.g. | ||
'foo-bar-XXXXXX'. | ||
* `dir`: the optional temporary directory that must be relative to the system's default temporary directory. | ||
@@ -356,0 +377,0 @@ absolute paths are fine as long as they point to a location under the system's default temporary directory. |
387
37341
4
668
+ Added@isaacs/cliui@8.0.2(transitive)
+ Added@pkgjs/parseargs@0.11.0(transitive)
+ Addedansi-regex@5.0.16.0.1(transitive)
+ Addedansi-styles@4.3.06.2.1(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcross-spawn@7.0.3(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@8.0.09.2.2(transitive)
+ Addedforeground-child@3.2.1(transitive)
+ Addedglob@10.4.2(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjackspeak@3.4.0(transitive)
+ Addedlru-cache@10.3.0(transitive)
+ Addedminimatch@9.0.5(transitive)
+ Addedminipass@7.1.2(transitive)
+ Addedpackage-json-from-dist@1.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedrimraf@5.0.7(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstring-width@4.2.35.1.2(transitive)
+ Addedstrip-ansi@6.0.17.1.0(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwrap-ansi@7.0.08.1.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedrimraf@^5.0.5