Skip to content

Commit bc3dcab

Browse files
committed
1 parent 9500e10 commit bc3dcab

File tree

10 files changed

+491
-307
lines changed

10 files changed

+491
-307
lines changed

CHANGELOG.md

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## tmp v0.2.0
44

5+
- drop support for node version < v8
6+
7+
***BREAKING CHANGE***
8+
9+
node version < v8 are no longer supported.
10+
511
- [#216](https://github.com/raszi/node-tmp/issues/216)
612

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

14-
The simplest handler possible would be
20+
A simple handler would be
1521

1622
```
1723
process.on('SIGINT', process.exit);
1824
```
1925

20-
- [#206](https://github.com/raszi/node-tmp/issues/206)
26+
- [#156](https://github.com/raszi/node-tmp/issues/156)
2127

22-
document name option.
28+
***BREAKING CHANGE***
29+
30+
template option no longer accepts arbitrary paths. all paths must be relative to os.tmpdir().
31+
the template option can point to an absolute path that is located under os.tmpdir().
32+
this can now be used in conjunction with the dir option.
33+
34+
- [#207](https://github.com/raszi/node-tmp/issues/TBD)
35+
36+
***BREAKING CHANGE***
37+
38+
dir option no longer accepts arbitrary paths. all paths must be relative to os.tmpdir().
39+
the dir option can point to an absolute path that is located under os.tmpdir().
40+
41+
- [#218](https://github.com/raszi/node-tmp/issues/TBD)
42+
43+
***BREAKING CHANGE***
44+
45+
name option no longer accepts arbitrary paths. name must no longer contain a path and will always be made relative
46+
to the current os.tmpdir() and the optional dir option.
2347

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

50+
***BUG FIX***
51+
2652
sync cleanup callback must be returned when using the sync API functions.
2753

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

30-
- [#179](https://github.com/raszi/node-tmp/issues/179)
56+
- [#176](https://github.com/raszi/node-tmp/issues/176)
57+
58+
***BUG FIX***
3159

32-
template option no longer accepts arbitrary paths.
60+
fail early if no os.tmpdir() was specified.
61+
previous versions of Electron did return undefined when calling os.tmpdir().
62+
_getTmpDir() now tries to resolve the path returned by os.tmpdir().
63+
64+
now using rimraf for removing directory trees.
3365

34-
- [#176](https://github.com/raszi/node-tmp/issues/176)
66+
- [#206](https://github.com/raszi/node-tmp/issues/206)
3567

36-
fail early if no tmp dir was specified.
68+
**DOCUMENTATION**
3769

38-
use rimraf for removing directory trees.
70+
document name option.
71+
72+
- [#236](https://github.com/raszi/node-tmp/issues/236)
73+
74+
**DOCUMENTATION**
75+
76+
document discardDescriptor option.
77+
78+
- [#237](https://github.com/raszi/node-tmp/issues/237)
79+
80+
**DOCUMENTATION**
81+
82+
document detachDescriptor option.
83+
84+
- [#238](https://github.com/raszi/node-tmp/issues/238)
85+
86+
**DOCUMENTATION**
87+
88+
document mode option.
3989

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

42-
add unsafeCleanup option to jsdoc.
92+
**DOCUMENTATION**
4393

44-
- drop support for node version < v8
94+
document unsafeCleanup option.
4595

46-
***BREAKING CHANGE***
47-
48-
node version < v8 are no longer supported.
96+
### Miscellaneous
4997

5098
- stabilized tests
51-
5299
- general clean up
53-
54100
- update jsdoc
55101

56102

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,25 @@ tmp.setGracefulCleanup();
343343

344344
All options are optional :)
345345

346-
* `name`: a fixed name that overrides random name generation
347-
* `mode`: the file mode to create with, it fallbacks to `0600` on file creation and `0700` on directory creation
348-
* `prefix`: the optional prefix, fallbacks to `tmp-` if not provided
349-
* `postfix`: the optional postfix, fallbacks to `.tmp` on file creation
350-
* `template`: [`mkstemp`][3] like filename template, no default
351-
* `dir`: the optional temporary directory, fallbacks to system default (guesses from environment)
346+
* `name`: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
347+
* `mode`: the file mode to create with, falls back to `0o600` on file creation and `0o700` on directory creation
348+
* `prefix`: the optional prefix, defaults to `tmp`
349+
* `postfix`: the optional postfix
350+
* `template`: [`mkstemp`][3] like filename template, no default, can be either an absolute or a relative path that resolves
351+
to a relative path of the system's default temporary directory, must include `XXXXXX` once for random name generation, e.g.
352+
'foo/bar/XXXXXX'. Absolute paths are also fine as long as they are relative to os.tmpdir().
353+
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
354+
as tmp will not check the availability of the path, nor will it establish the requested path for you.
355+
* `dir`: the optional temporary directory that must be relative to the system's default temporary directory.
356+
absolute paths are fine as long as they point to a location under the system's default temporary directory.
357+
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
358+
as tmp will not check the availability of the path, nor will it establish the requested path for you.
352359
* `tries`: how many times should the function try to get a unique filename before giving up, default `3`
353360
* `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
354361
* In order to clean up, you will have to call the provided `cleanupCallback` function manually.
355362
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
363+
* `detachDescriptor`: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
364+
* `discardDescriptor`: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
356365

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

0 commit comments

Comments
 (0)