Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
silkentrance committed Feb 7, 2020
1 parent 9500e10 commit a4b0049
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 210 deletions.
73 changes: 58 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## tmp v0.2.0

- drop support for node version < v8

***BREAKING CHANGE***

node version < v8 are no longer supported.

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

***BREAKING CHANGE***
Expand All @@ -11,46 +17,83 @@
Users must install their own SIGINT handler and call process.exit() so that tmp's process
exit handler can do the cleanup.

The simplest handler possible would be
A simple handler would be

```
process.on('SIGINT', process.exit);
```

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

document name option.
***BREAKING CHANGE***

template option no longer accepts arbitrary paths. all paths must be relative to os.tmpdir().

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

***BREAKING CHANGE***

dir option no longer accepts arbitrary paths. all paths must be relative to os.tmpdir().

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

***BREAKING CHANGE***

name option no longer accepts arbitrary paths. name must no longer contain a path and will always be made relative
to the current os.tmpdir() and the optional dir option.

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

***BUG FIX***

sync cleanup callback must be returned when using the sync API functions.

fs.rmdirSync() must not be called with a second parameter that is a function.

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

template option no longer accepts arbitrary paths.
***BUG FIX***

- [#176](https://github.com/raszi/node-tmp/issues/176)
fail early if no os.tmpdir() was specified.
previous versions of Electron did return undefined when calling os.tmpdir().
_getTmpDir() now tries to resolve the path returned by os.tmpdir().

now using rimraf for removing directory trees.

fail early if no tmp dir was specified.
- [#206](https://github.com/raszi/node-tmp/issues/206)

**DOCUMENTATION**

use rimraf for removing directory trees.
document name option.

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

**DOCUMENTATION**

document discardDescriptor option.

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

**DOCUMENTATION**

document detachDescriptor option.

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

**DOCUMENTATION**

document mode option.

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

add unsafeCleanup option to jsdoc.
**DOCUMENTATION**

- drop support for node version < v8
document unsafeCleanup option.

***BREAKING CHANGE***

node version < v8 are no longer supported.
### Miscellaneous

- stabilized tests

- general clean up

- update jsdoc


Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,25 @@ tmp.setGracefulCleanup();

All options are optional :)

* `name`: a fixed name that overrides random name generation
* `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation
* `prefix`: the optional prefix, fallbacks to `tmp-` if not provided
* `postfix`: the optional postfix, fallbacks to `.tmp` on file creation
* `template`: [`mkstemp`][3] like filename template, no default
* `dir`: the optional temporary directory, fallbacks to system default (guesses from environment)
* `name`: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
* `mode`: the file mode to create with, falls back to `0o600` on file creation and `0o700` on directory creation
* `prefix`: the optional prefix, defaults to `tmp`
* `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.
* `dir`: 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,
as tmp will not check the availability of the path, nor will it establish the requested path for you.
* `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.
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
* `detachDescriptor`: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
* `discardDescriptor`: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection

[1]: http://nodejs.org/
[2]: https://www.npmjs.com/browse/depended/tmp
Expand Down

0 comments on commit a4b0049

Please sign in to comment.