protobufjs 6.11.2 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -174
- package/dist/light/protobuf.js +77 -29
- package/dist/light/protobuf.js.map +1 -1
- package/dist/light/protobuf.min.js +3 -3
- package/dist/light/protobuf.min.js.map +1 -1
- package/dist/minimal/protobuf.js +27 -10
- package/dist/minimal/protobuf.js.map +1 -1
- package/dist/minimal/protobuf.min.js +3 -3
- package/dist/minimal/protobuf.min.js.map +1 -1
- package/dist/protobuf.js +163 -61
- package/dist/protobuf.js.map +1 -1
- package/dist/protobuf.min.js +3 -3
- package/dist/protobuf.min.js.map +1 -1
- package/index.d.ts +9 -7
- package/package.json +14 -33
- package/scripts/postinstall.js +0 -3
- package/src/converter.js +10 -4
- package/src/decoder.js +4 -3
- package/src/enum.js +24 -7
- package/src/field.js +6 -3
- package/src/namespace.js +3 -3
- package/src/parse.js +55 -16
- package/src/roots.js +1 -1
- package/src/tokenize.js +31 -16
- package/src/util/minimal.js +24 -7
- package/src/util.js +3 -0
- package/src/wrappers.js +2 -2
- package/tsconfig.json +2 -1
- package/CHANGELOG.md +0 -1019
- package/bin/pbjs +0 -6
- package/bin/pbts +0 -6
- package/cli/LICENSE +0 -33
- package/cli/README.md +0 -174
- package/cli/bin/pbjs +0 -6
- package/cli/bin/pbts +0 -6
- package/cli/index.d.ts +0 -3
- package/cli/index.js +0 -3
- package/cli/lib/tsd-jsdoc/LICENSE +0 -21
- package/cli/lib/tsd-jsdoc/README.md +0 -23
- package/cli/lib/tsd-jsdoc/plugin.js +0 -21
- package/cli/lib/tsd-jsdoc/publish.js +0 -705
- package/cli/lib/tsd-jsdoc.json +0 -18
- package/cli/node_modules/.package-lock.json +0 -256
- package/cli/node_modules/acorn/CHANGELOG.md +0 -620
- package/cli/node_modules/acorn/LICENSE +0 -21
- package/cli/node_modules/acorn/README.md +0 -269
- package/cli/node_modules/acorn/bin/acorn +0 -4
- package/cli/node_modules/acorn/dist/acorn.d.ts +0 -209
- package/cli/node_modules/acorn/dist/acorn.js +0 -5186
- package/cli/node_modules/acorn/dist/acorn.js.map +0 -1
- package/cli/node_modules/acorn/dist/acorn.mjs +0 -5155
- package/cli/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
- package/cli/node_modules/acorn/dist/acorn.mjs.map +0 -1
- package/cli/node_modules/acorn/dist/bin.js +0 -64
- package/cli/node_modules/acorn/package.json +0 -35
- package/cli/node_modules/acorn-jsx/LICENSE +0 -19
- package/cli/node_modules/acorn-jsx/README.md +0 -40
- package/cli/node_modules/acorn-jsx/index.js +0 -488
- package/cli/node_modules/acorn-jsx/package.json +0 -27
- package/cli/node_modules/acorn-jsx/xhtml.js +0 -255
- package/cli/node_modules/balanced-match/.npmignore +0 -5
- package/cli/node_modules/balanced-match/LICENSE.md +0 -21
- package/cli/node_modules/balanced-match/README.md +0 -91
- package/cli/node_modules/balanced-match/index.js +0 -59
- package/cli/node_modules/balanced-match/package.json +0 -49
- package/cli/node_modules/brace-expansion/LICENSE +0 -21
- package/cli/node_modules/brace-expansion/README.md +0 -129
- package/cli/node_modules/brace-expansion/index.js +0 -201
- package/cli/node_modules/brace-expansion/package.json +0 -47
- package/cli/node_modules/concat-map/.travis.yml +0 -4
- package/cli/node_modules/concat-map/LICENSE +0 -18
- package/cli/node_modules/concat-map/README.markdown +0 -62
- package/cli/node_modules/concat-map/example/map.js +0 -6
- package/cli/node_modules/concat-map/index.js +0 -13
- package/cli/node_modules/concat-map/package.json +0 -43
- package/cli/node_modules/concat-map/test/map.js +0 -39
- package/cli/node_modules/deep-is/.npmignore +0 -1
- package/cli/node_modules/deep-is/.travis.yml +0 -6
- package/cli/node_modules/deep-is/LICENSE +0 -22
- package/cli/node_modules/deep-is/README.markdown +0 -70
- package/cli/node_modules/deep-is/example/cmp.js +0 -11
- package/cli/node_modules/deep-is/index.js +0 -102
- package/cli/node_modules/deep-is/package.json +0 -61
- package/cli/node_modules/deep-is/test/NaN.js +0 -16
- package/cli/node_modules/deep-is/test/cmp.js +0 -23
- package/cli/node_modules/deep-is/test/neg-vs-pos-0.js +0 -15
- package/cli/node_modules/escodegen/LICENSE.BSD +0 -21
- package/cli/node_modules/escodegen/README.md +0 -84
- package/cli/node_modules/escodegen/bin/escodegen.js +0 -77
- package/cli/node_modules/escodegen/bin/esgenerate.js +0 -64
- package/cli/node_modules/escodegen/escodegen.js +0 -2647
- package/cli/node_modules/escodegen/package.json +0 -62
- package/cli/node_modules/eslint-visitor-keys/CHANGELOG.md +0 -25
- package/cli/node_modules/eslint-visitor-keys/LICENSE +0 -201
- package/cli/node_modules/eslint-visitor-keys/README.md +0 -98
- package/cli/node_modules/eslint-visitor-keys/lib/index.js +0 -81
- package/cli/node_modules/eslint-visitor-keys/lib/visitor-keys.json +0 -284
- package/cli/node_modules/eslint-visitor-keys/package.json +0 -40
- package/cli/node_modules/espree/CHANGELOG.md +0 -509
- package/cli/node_modules/espree/LICENSE +0 -25
- package/cli/node_modules/espree/README.md +0 -233
- package/cli/node_modules/espree/espree.js +0 -177
- package/cli/node_modules/espree/lib/ast-node-types.js +0 -96
- package/cli/node_modules/espree/lib/espree.js +0 -286
- package/cli/node_modules/espree/lib/features.js +0 -29
- package/cli/node_modules/espree/lib/options.js +0 -106
- package/cli/node_modules/espree/lib/token-translator.js +0 -263
- package/cli/node_modules/espree/lib/visitor-keys.js +0 -123
- package/cli/node_modules/espree/package.json +0 -64
- package/cli/node_modules/esprima/ChangeLog +0 -235
- package/cli/node_modules/esprima/LICENSE.BSD +0 -21
- package/cli/node_modules/esprima/README.md +0 -46
- package/cli/node_modules/esprima/bin/esparse.js +0 -139
- package/cli/node_modules/esprima/bin/esvalidate.js +0 -236
- package/cli/node_modules/esprima/dist/esprima.js +0 -6709
- package/cli/node_modules/esprima/package.json +0 -112
- package/cli/node_modules/estraverse/.jshintrc +0 -16
- package/cli/node_modules/estraverse/LICENSE.BSD +0 -19
- package/cli/node_modules/estraverse/README.md +0 -153
- package/cli/node_modules/estraverse/estraverse.js +0 -801
- package/cli/node_modules/estraverse/gulpfile.js +0 -70
- package/cli/node_modules/estraverse/package.json +0 -40
- package/cli/node_modules/esutils/LICENSE.BSD +0 -19
- package/cli/node_modules/esutils/README.md +0 -174
- package/cli/node_modules/esutils/lib/ast.js +0 -144
- package/cli/node_modules/esutils/lib/code.js +0 -135
- package/cli/node_modules/esutils/lib/keyword.js +0 -165
- package/cli/node_modules/esutils/lib/utils.js +0 -33
- package/cli/node_modules/esutils/package.json +0 -44
- package/cli/node_modules/fast-levenshtein/LICENSE.md +0 -25
- package/cli/node_modules/fast-levenshtein/README.md +0 -104
- package/cli/node_modules/fast-levenshtein/levenshtein.js +0 -136
- package/cli/node_modules/fast-levenshtein/package.json +0 -39
- package/cli/node_modules/fs.realpath/LICENSE +0 -43
- package/cli/node_modules/fs.realpath/README.md +0 -33
- package/cli/node_modules/fs.realpath/index.js +0 -66
- package/cli/node_modules/fs.realpath/old.js +0 -303
- package/cli/node_modules/fs.realpath/package.json +0 -26
- package/cli/node_modules/glob/LICENSE +0 -21
- package/cli/node_modules/glob/README.md +0 -375
- package/cli/node_modules/glob/changelog.md +0 -67
- package/cli/node_modules/glob/common.js +0 -240
- package/cli/node_modules/glob/glob.js +0 -790
- package/cli/node_modules/glob/package.json +0 -46
- package/cli/node_modules/glob/sync.js +0 -486
- package/cli/node_modules/inflight/LICENSE +0 -15
- package/cli/node_modules/inflight/README.md +0 -37
- package/cli/node_modules/inflight/inflight.js +0 -54
- package/cli/node_modules/inflight/package.json +0 -29
- package/cli/node_modules/inherits/LICENSE +0 -16
- package/cli/node_modules/inherits/README.md +0 -42
- package/cli/node_modules/inherits/inherits.js +0 -9
- package/cli/node_modules/inherits/inherits_browser.js +0 -27
- package/cli/node_modules/inherits/package.json +0 -29
- package/cli/node_modules/levn/LICENSE +0 -22
- package/cli/node_modules/levn/README.md +0 -196
- package/cli/node_modules/levn/lib/cast.js +0 -298
- package/cli/node_modules/levn/lib/coerce.js +0 -285
- package/cli/node_modules/levn/lib/index.js +0 -22
- package/cli/node_modules/levn/lib/parse-string.js +0 -113
- package/cli/node_modules/levn/lib/parse.js +0 -102
- package/cli/node_modules/levn/package.json +0 -47
- package/cli/node_modules/minimatch/LICENSE +0 -15
- package/cli/node_modules/minimatch/README.md +0 -209
- package/cli/node_modules/minimatch/minimatch.js +0 -923
- package/cli/node_modules/minimatch/package.json +0 -30
- package/cli/node_modules/once/LICENSE +0 -15
- package/cli/node_modules/once/README.md +0 -79
- package/cli/node_modules/once/once.js +0 -42
- package/cli/node_modules/once/package.json +0 -33
- package/cli/node_modules/optionator/CHANGELOG.md +0 -56
- package/cli/node_modules/optionator/LICENSE +0 -22
- package/cli/node_modules/optionator/README.md +0 -238
- package/cli/node_modules/optionator/lib/help.js +0 -260
- package/cli/node_modules/optionator/lib/index.js +0 -465
- package/cli/node_modules/optionator/lib/util.js +0 -54
- package/cli/node_modules/optionator/package.json +0 -44
- package/cli/node_modules/path-is-absolute/index.js +0 -20
- package/cli/node_modules/path-is-absolute/license +0 -21
- package/cli/node_modules/path-is-absolute/package.json +0 -43
- package/cli/node_modules/path-is-absolute/readme.md +0 -59
- package/cli/node_modules/prelude-ls/CHANGELOG.md +0 -99
- package/cli/node_modules/prelude-ls/LICENSE +0 -22
- package/cli/node_modules/prelude-ls/README.md +0 -15
- package/cli/node_modules/prelude-ls/lib/Func.js +0 -65
- package/cli/node_modules/prelude-ls/lib/List.js +0 -686
- package/cli/node_modules/prelude-ls/lib/Num.js +0 -130
- package/cli/node_modules/prelude-ls/lib/Obj.js +0 -154
- package/cli/node_modules/prelude-ls/lib/Str.js +0 -92
- package/cli/node_modules/prelude-ls/lib/index.js +0 -178
- package/cli/node_modules/prelude-ls/package.json +0 -52
- package/cli/node_modules/rimraf/CHANGELOG.md +0 -65
- package/cli/node_modules/rimraf/LICENSE +0 -15
- package/cli/node_modules/rimraf/README.md +0 -101
- package/cli/node_modules/rimraf/bin.js +0 -68
- package/cli/node_modules/rimraf/package.json +0 -32
- package/cli/node_modules/rimraf/rimraf.js +0 -360
- package/cli/node_modules/source-map/CHANGELOG.md +0 -301
- package/cli/node_modules/source-map/LICENSE +0 -28
- package/cli/node_modules/source-map/README.md +0 -742
- package/cli/node_modules/source-map/dist/source-map.debug.js +0 -3234
- package/cli/node_modules/source-map/dist/source-map.js +0 -3233
- package/cli/node_modules/source-map/dist/source-map.min.js +0 -2
- package/cli/node_modules/source-map/dist/source-map.min.js.map +0 -1
- package/cli/node_modules/source-map/lib/array-set.js +0 -121
- package/cli/node_modules/source-map/lib/base64-vlq.js +0 -140
- package/cli/node_modules/source-map/lib/base64.js +0 -67
- package/cli/node_modules/source-map/lib/binary-search.js +0 -111
- package/cli/node_modules/source-map/lib/mapping-list.js +0 -79
- package/cli/node_modules/source-map/lib/quick-sort.js +0 -114
- package/cli/node_modules/source-map/lib/source-map-consumer.js +0 -1145
- package/cli/node_modules/source-map/lib/source-map-generator.js +0 -425
- package/cli/node_modules/source-map/lib/source-node.js +0 -413
- package/cli/node_modules/source-map/lib/util.js +0 -488
- package/cli/node_modules/source-map/package.json +0 -73
- package/cli/node_modules/source-map/source-map.d.ts +0 -98
- package/cli/node_modules/source-map/source-map.js +0 -8
- package/cli/node_modules/tmp/CHANGELOG.md +0 -288
- package/cli/node_modules/tmp/LICENSE +0 -21
- package/cli/node_modules/tmp/README.md +0 -365
- package/cli/node_modules/tmp/lib/tmp.js +0 -780
- package/cli/node_modules/tmp/package.json +0 -58
- package/cli/node_modules/type-check/LICENSE +0 -22
- package/cli/node_modules/type-check/README.md +0 -210
- package/cli/node_modules/type-check/lib/check.js +0 -126
- package/cli/node_modules/type-check/lib/index.js +0 -16
- package/cli/node_modules/type-check/lib/parse-type.js +0 -196
- package/cli/node_modules/type-check/package.json +0 -40
- package/cli/node_modules/word-wrap/LICENSE +0 -21
- package/cli/node_modules/word-wrap/README.md +0 -182
- package/cli/node_modules/word-wrap/index.d.ts +0 -50
- package/cli/node_modules/word-wrap/index.js +0 -46
- package/cli/node_modules/word-wrap/package.json +0 -77
- package/cli/node_modules/wrappy/LICENSE +0 -15
- package/cli/node_modules/wrappy/README.md +0 -36
- package/cli/node_modules/wrappy/package.json +0 -29
- package/cli/node_modules/wrappy/wrappy.js +0 -33
- package/cli/package.json +0 -8
- package/cli/package.standalone.json +0 -32
- package/cli/pbjs.d.ts +0 -9
- package/cli/pbjs.js +0 -330
- package/cli/pbts.d.ts +0 -9
- package/cli/pbts.js +0 -197
- package/cli/targets/json-module.js +0 -38
- package/cli/targets/json.js +0 -8
- package/cli/targets/proto.js +0 -326
- package/cli/targets/proto2.js +0 -10
- package/cli/targets/proto3.js +0 -10
- package/cli/targets/static-module.js +0 -29
- package/cli/targets/static.js +0 -711
- package/cli/util.js +0 -183
- package/cli/wrappers/amd.js +0 -7
- package/cli/wrappers/closure.js +0 -7
- package/cli/wrappers/commonjs.js +0 -7
- package/cli/wrappers/default.js +0 -15
- package/cli/wrappers/es6.js +0 -5
- package/dist/README.md +0 -31
- package/dist/light/README.md +0 -31
- package/dist/minimal/README.md +0 -31
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## v0.2.1 (2020-04-28)
|
|
4
|
-
|
|
5
|
-
#### :rocket: Enhancement
|
|
6
|
-
* [#252](https://github.com/raszi/node-tmp/pull/252) Closes [#250](https://github.com/raszi/node-tmp/issues/250): introduce tmpdir option for overriding the system tmp dir ([@silkentrance](https://github.com/silkentrance))
|
|
7
|
-
|
|
8
|
-
#### :house: Internal
|
|
9
|
-
* [#253](https://github.com/raszi/node-tmp/pull/253) Closes [#191](https://github.com/raszi/node-tmp/issues/191): generate changelog from pull requests using lerna-changelog ([@silkentrance](https://github.com/silkentrance))
|
|
10
|
-
|
|
11
|
-
#### Committers: 1
|
|
12
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## v0.2.0 (2020-04-25)
|
|
16
|
-
|
|
17
|
-
#### :rocket: Enhancement
|
|
18
|
-
* [#234](https://github.com/raszi/node-tmp/pull/234) feat: stabilize tmp for v0.2.0 release ([@silkentrance](https://github.com/silkentrance))
|
|
19
|
-
|
|
20
|
-
#### :bug: Bug Fix
|
|
21
|
-
* [#231](https://github.com/raszi/node-tmp/pull/231) Closes [#230](https://github.com/raszi/node-tmp/issues/230): regression after fix for #197 ([@silkentrance](https://github.com/silkentrance))
|
|
22
|
-
* [#220](https://github.com/raszi/node-tmp/pull/220) Closes [#197](https://github.com/raszi/node-tmp/issues/197): return sync callback when using the sync interface, otherwise return the async callback ([@silkentrance](https://github.com/silkentrance))
|
|
23
|
-
* [#193](https://github.com/raszi/node-tmp/pull/193) Closes [#192](https://github.com/raszi/node-tmp/issues/192): tmp must not exit the process on its own ([@silkentrance](https://github.com/silkentrance))
|
|
24
|
-
|
|
25
|
-
#### :memo: Documentation
|
|
26
|
-
* [#221](https://github.com/raszi/node-tmp/pull/221) Gh 206 document name option ([@silkentrance](https://github.com/silkentrance))
|
|
27
|
-
|
|
28
|
-
#### :house: Internal
|
|
29
|
-
* [#226](https://github.com/raszi/node-tmp/pull/226) Closes [#212](https://github.com/raszi/node-tmp/issues/212): enable direct name option test ([@silkentrance](https://github.com/silkentrance))
|
|
30
|
-
* [#225](https://github.com/raszi/node-tmp/pull/225) Closes [#211](https://github.com/raszi/node-tmp/issues/211): existing tests must clean up after themselves ([@silkentrance](https://github.com/silkentrance))
|
|
31
|
-
* [#224](https://github.com/raszi/node-tmp/pull/224) Closes [#217](https://github.com/raszi/node-tmp/issues/217): name tests must use tmpName ([@silkentrance](https://github.com/silkentrance))
|
|
32
|
-
* [#223](https://github.com/raszi/node-tmp/pull/223) Closes [#214](https://github.com/raszi/node-tmp/issues/214): refactor tests and lib ([@silkentrance](https://github.com/silkentrance))
|
|
33
|
-
* [#198](https://github.com/raszi/node-tmp/pull/198) Update dependencies to latest versions ([@matsev](https://github.com/matsev))
|
|
34
|
-
|
|
35
|
-
#### Committers: 2
|
|
36
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
37
|
-
- Mattias Severson ([@matsev](https://github.com/matsev))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## v0.1.0 (2019-03-20)
|
|
41
|
-
|
|
42
|
-
#### :rocket: Enhancement
|
|
43
|
-
* [#177](https://github.com/raszi/node-tmp/pull/177) fix: fail early if there is no tmp dir specified ([@silkentrance](https://github.com/silkentrance))
|
|
44
|
-
* [#159](https://github.com/raszi/node-tmp/pull/159) Closes [#121](https://github.com/raszi/node-tmp/issues/121) ([@silkentrance](https://github.com/silkentrance))
|
|
45
|
-
* [#161](https://github.com/raszi/node-tmp/pull/161) Closes [#155](https://github.com/raszi/node-tmp/issues/155) ([@silkentrance](https://github.com/silkentrance))
|
|
46
|
-
* [#166](https://github.com/raszi/node-tmp/pull/166) fix: avoid relying on Node’s internals ([@addaleax](https://github.com/addaleax))
|
|
47
|
-
* [#144](https://github.com/raszi/node-tmp/pull/144) prepend opts.dir || tmpDir to template if no path is given ([@silkentrance](https://github.com/silkentrance))
|
|
48
|
-
|
|
49
|
-
#### :bug: Bug Fix
|
|
50
|
-
* [#183](https://github.com/raszi/node-tmp/pull/183) Closes [#182](https://github.com/raszi/node-tmp/issues/182) fileSync takes empty string postfix option ([@gutte](https://github.com/gutte))
|
|
51
|
-
* [#130](https://github.com/raszi/node-tmp/pull/130) Closes [#129](https://github.com/raszi/node-tmp/issues/129) install process listeners safely ([@silkentrance](https://github.com/silkentrance))
|
|
52
|
-
|
|
53
|
-
#### :memo: Documentation
|
|
54
|
-
* [#188](https://github.com/raszi/node-tmp/pull/188) HOTCloses [#187](https://github.com/raszi/node-tmp/issues/187): restore behaviour for #182 ([@silkentrance](https://github.com/silkentrance))
|
|
55
|
-
* [#180](https://github.com/raszi/node-tmp/pull/180) fix gh-179: template no longer accepts arbitrary paths ([@silkentrance](https://github.com/silkentrance))
|
|
56
|
-
* [#175](https://github.com/raszi/node-tmp/pull/175) docs: add `unsafeCleanup` option to jsdoc ([@kerimdzhanov](https://github.com/kerimdzhanov))
|
|
57
|
-
* [#151](https://github.com/raszi/node-tmp/pull/151) docs: fix link to tmp-promise ([@silkentrance](https://github.com/silkentrance))
|
|
58
|
-
|
|
59
|
-
#### :house: Internal
|
|
60
|
-
* [#184](https://github.com/raszi/node-tmp/pull/184) test: add missing tests for #182 ([@silkentrance](https://github.com/silkentrance))
|
|
61
|
-
* [#171](https://github.com/raszi/node-tmp/pull/171) chore: drop old NodeJS support ([@poppinlp](https://github.com/poppinlp))
|
|
62
|
-
* [#170](https://github.com/raszi/node-tmp/pull/170) chore: update dependencies ([@raszi](https://github.com/raszi))
|
|
63
|
-
* [#165](https://github.com/raszi/node-tmp/pull/165) test: add missing tests ([@raszi](https://github.com/raszi))
|
|
64
|
-
* [#163](https://github.com/raszi/node-tmp/pull/163) chore: add lint npm task ([@raszi](https://github.com/raszi))
|
|
65
|
-
* [#107](https://github.com/raszi/node-tmp/pull/107) chore: add coverage report ([@raszi](https://github.com/raszi))
|
|
66
|
-
* [#141](https://github.com/raszi/node-tmp/pull/141) test: refactor tests for mocha ([@silkentrance](https://github.com/silkentrance))
|
|
67
|
-
* [#154](https://github.com/raszi/node-tmp/pull/154) chore: change Travis configuration ([@raszi](https://github.com/raszi))
|
|
68
|
-
* [#152](https://github.com/raszi/node-tmp/pull/152) fix: drop Node v0.6.0 ([@raszi](https://github.com/raszi))
|
|
69
|
-
|
|
70
|
-
#### Committers: 6
|
|
71
|
-
- Anna Henningsen ([@addaleax](https://github.com/addaleax))
|
|
72
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
73
|
-
- Dan Kerimdzhanov ([@kerimdzhanov](https://github.com/kerimdzhanov))
|
|
74
|
-
- Gustav Klingstedt ([@gutte](https://github.com/gutte))
|
|
75
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
76
|
-
- PoppinL ([@poppinlp](https://github.com/poppinlp))
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## v0.0.33 (2017-08-12)
|
|
80
|
-
|
|
81
|
-
#### :rocket: Enhancement
|
|
82
|
-
* [#147](https://github.com/raszi/node-tmp/pull/147) fix: with name option try at most once to get a unique tmp name ([@silkentrance](https://github.com/silkentrance))
|
|
83
|
-
|
|
84
|
-
#### :bug: Bug Fix
|
|
85
|
-
* [#149](https://github.com/raszi/node-tmp/pull/149) fix(fileSync): must honor detachDescriptor and discardDescriptor options ([@silkentrance](https://github.com/silkentrance))
|
|
86
|
-
* [#119](https://github.com/raszi/node-tmp/pull/119) Closes [#115](https://github.com/raszi/node-tmp/issues/115) ([@silkentrance](https://github.com/silkentrance))
|
|
87
|
-
|
|
88
|
-
#### :memo: Documentation
|
|
89
|
-
* [#128](https://github.com/raszi/node-tmp/pull/128) Closes [#127](https://github.com/raszi/node-tmp/issues/127) add reference to tmp-promise ([@silkentrance](https://github.com/silkentrance))
|
|
90
|
-
|
|
91
|
-
#### :house: Internal
|
|
92
|
-
* [#135](https://github.com/raszi/node-tmp/pull/135) Closes [#133](https://github.com/raszi/node-tmp/issues/133), #134 ([@silkentrance](https://github.com/silkentrance))
|
|
93
|
-
* [#123](https://github.com/raszi/node-tmp/pull/123) docs: update tmp.js MIT license header to 2017 ([@madnight](https://github.com/madnight))
|
|
94
|
-
* [#122](https://github.com/raszi/node-tmp/pull/122) chore: add issue template ([@silkentrance](https://github.com/silkentrance))
|
|
95
|
-
|
|
96
|
-
#### Committers: 2
|
|
97
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
98
|
-
- Fabian Beuke ([@madnight](https://github.com/madnight))
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
## v0.0.32 (2017-03-24)
|
|
102
|
-
|
|
103
|
-
#### :memo: Documentation
|
|
104
|
-
* [#106](https://github.com/raszi/node-tmp/pull/106) doc: add proper JSDoc documentation ([@raszi](https://github.com/raszi))
|
|
105
|
-
|
|
106
|
-
#### :house: Internal
|
|
107
|
-
* [#111](https://github.com/raszi/node-tmp/pull/111) test: add Windows tests ([@binki](https://github.com/binki))
|
|
108
|
-
* [#110](https://github.com/raszi/node-tmp/pull/110) chore: add AppVeyor ([@binki](https://github.com/binki))
|
|
109
|
-
* [#105](https://github.com/raszi/node-tmp/pull/105) chore: use const where possible ([@raszi](https://github.com/raszi))
|
|
110
|
-
* [#104](https://github.com/raszi/node-tmp/pull/104) style: fix various style issues ([@raszi](https://github.com/raszi))
|
|
111
|
-
|
|
112
|
-
#### Committers: 2
|
|
113
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
114
|
-
- Nathan Phillip Brink ([@binki](https://github.com/binki))
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
## v0.0.31 (2016-11-21)
|
|
118
|
-
|
|
119
|
-
#### :rocket: Enhancement
|
|
120
|
-
* [#99](https://github.com/raszi/node-tmp/pull/99) feat: add next callback functionality ([@silkentrance](https://github.com/silkentrance))
|
|
121
|
-
* [#94](https://github.com/raszi/node-tmp/pull/94) feat: add options to control descriptor management ([@pabigot](https://github.com/pabigot))
|
|
122
|
-
|
|
123
|
-
#### :house: Internal
|
|
124
|
-
* [#101](https://github.com/raszi/node-tmp/pull/101) fix: Include files in the package.json ([@raszi](https://github.com/raszi))
|
|
125
|
-
|
|
126
|
-
#### Committers: 3
|
|
127
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
128
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
129
|
-
- Peter A. Bigot ([@pabigot](https://github.com/pabigot))
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
## v0.0.30 (2016-11-01)
|
|
133
|
-
|
|
134
|
-
#### :bug: Bug Fix
|
|
135
|
-
* [#96](https://github.com/raszi/node-tmp/pull/96) fix: constants for Node 6 ([@jnj16180340](https://github.com/jnj16180340))
|
|
136
|
-
* [#98](https://github.com/raszi/node-tmp/pull/98) fix: garbage collector ([@Ari-H](https://github.com/Ari-H))
|
|
137
|
-
|
|
138
|
-
#### Committers: 2
|
|
139
|
-
- Nate Johnson ([@jnj16180340](https://github.com/jnj16180340))
|
|
140
|
-
- [@Ari-H](https://github.com/Ari-H)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## v0.0.29 (2016-09-18)
|
|
144
|
-
|
|
145
|
-
#### :rocket: Enhancement
|
|
146
|
-
* [#87](https://github.com/raszi/node-tmp/pull/87) fix: replace calls to deprecated fs API functions ([@OlliV](https://github.com/OlliV))
|
|
147
|
-
|
|
148
|
-
#### :bug: Bug Fix
|
|
149
|
-
* [#70](https://github.com/raszi/node-tmp/pull/70) fix: prune `_removeObjects` correctly ([@joliss](https://github.com/joliss))
|
|
150
|
-
* [#71](https://github.com/raszi/node-tmp/pull/71) Fix typo ([@gcampax](https://github.com/gcampax))
|
|
151
|
-
|
|
152
|
-
#### :memo: Documentation
|
|
153
|
-
* [#77](https://github.com/raszi/node-tmp/pull/77) docs: change mkstemps to mkstemp ([@thefourtheye](https://github.com/thefourtheye))
|
|
154
|
-
|
|
155
|
-
#### :house: Internal
|
|
156
|
-
* [#92](https://github.com/raszi/node-tmp/pull/92) chore: add Travis CI support for Node 6 ([@amilajack](https://github.com/amilajack))
|
|
157
|
-
* [#79](https://github.com/raszi/node-tmp/pull/79) fix: remove unneeded require statement ([@whmountains](https://github.com/whmountains))
|
|
158
|
-
|
|
159
|
-
#### Committers: 6
|
|
160
|
-
- Amila Welihinda ([@amilajack](https://github.com/amilajack))
|
|
161
|
-
- Caleb Whiting ([@whmountains](https://github.com/whmountains))
|
|
162
|
-
- Giovanni Campagna ([@gcampax](https://github.com/gcampax))
|
|
163
|
-
- Jo Liss ([@joliss](https://github.com/joliss))
|
|
164
|
-
- Olli Vanhoja ([@OlliV](https://github.com/OlliV))
|
|
165
|
-
- Sakthipriyan Vairamani ([@thefourtheye](https://github.com/thefourtheye))
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
## v0.0.28 (2015-09-27)
|
|
169
|
-
|
|
170
|
-
#### :bug: Bug Fix
|
|
171
|
-
* [#63](https://github.com/raszi/node-tmp/pull/63) fix: delete for _rmdirRecursiveSync ([@voltrevo](https://github.com/voltrevo))
|
|
172
|
-
|
|
173
|
-
#### :memo: Documentation
|
|
174
|
-
* [#64](https://github.com/raszi/node-tmp/pull/64) docs: fix typo in the README ([@JTKnox91](https://github.com/JTKnox91))
|
|
175
|
-
|
|
176
|
-
#### :house: Internal
|
|
177
|
-
* [#67](https://github.com/raszi/node-tmp/pull/67) test: add node v4.0 v4.1 to travis config ([@raszi](https://github.com/raszi))
|
|
178
|
-
* [#66](https://github.com/raszi/node-tmp/pull/66) chore(deps): update deps ([@raszi](https://github.com/raszi))
|
|
179
|
-
|
|
180
|
-
#### Committers: 3
|
|
181
|
-
- Andrew Morris ([@voltrevo](https://github.com/voltrevo))
|
|
182
|
-
- John T. Knox ([@JTKnox91](https://github.com/JTKnox91))
|
|
183
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
## v0.0.27 (2015-08-15)
|
|
187
|
-
|
|
188
|
-
#### :bug: Bug Fix
|
|
189
|
-
* [#60](https://github.com/raszi/node-tmp/pull/60) fix: unlinking when the file has been already removed ([@silkentrance](https://github.com/silkentrance))
|
|
190
|
-
|
|
191
|
-
#### :memo: Documentation
|
|
192
|
-
* [#55](https://github.com/raszi/node-tmp/pull/55) docs(README): update README ([@raszi](https://github.com/raszi))
|
|
193
|
-
|
|
194
|
-
#### :house: Internal
|
|
195
|
-
* [#56](https://github.com/raszi/node-tmp/pull/56) style(jshint): fix JSHint error ([@raszi](https://github.com/raszi))
|
|
196
|
-
* [#53](https://github.com/raszi/node-tmp/pull/53) chore: update license attribute ([@pdehaan](https://github.com/pdehaan))
|
|
197
|
-
|
|
198
|
-
#### Committers: 3
|
|
199
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
200
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
201
|
-
- Peter deHaan ([@pdehaan](https://github.com/pdehaan))
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## v0.0.26 (2015-05-12)
|
|
205
|
-
|
|
206
|
-
#### :rocket: Enhancement
|
|
207
|
-
* [#40](https://github.com/raszi/node-tmp/pull/40) Fix for #39 ([@silkentrance](https://github.com/silkentrance))
|
|
208
|
-
* [#42](https://github.com/raszi/node-tmp/pull/42) Fix for #17 ([@silkentrance](https://github.com/silkentrance))
|
|
209
|
-
* [#41](https://github.com/raszi/node-tmp/pull/41) Fix for #37 ([@silkentrance](https://github.com/silkentrance))
|
|
210
|
-
* [#32](https://github.com/raszi/node-tmp/pull/32) add ability to customize file/dir names ([@shime](https://github.com/shime))
|
|
211
|
-
* [#29](https://github.com/raszi/node-tmp/pull/29) tmp.file have responsibility to close file, not only unlink file ([@vhain](https://github.com/vhain))
|
|
212
|
-
|
|
213
|
-
#### :bug: Bug Fix
|
|
214
|
-
* [#51](https://github.com/raszi/node-tmp/pull/51) fix(windows): fix tempDir on windows ([@raszi](https://github.com/raszi))
|
|
215
|
-
* [#49](https://github.com/raszi/node-tmp/pull/49) remove object from _removeObjects if cleanup fn is called Closes [#48](https://github.com/raszi/node-tmp/issues/48) ([@bmeck](https://github.com/bmeck))
|
|
216
|
-
|
|
217
|
-
#### :memo: Documentation
|
|
218
|
-
* [#45](https://github.com/raszi/node-tmp/pull/45) Fix for #44 ([@silkentrance](https://github.com/silkentrance))
|
|
219
|
-
|
|
220
|
-
#### :house: Internal
|
|
221
|
-
* [#34](https://github.com/raszi/node-tmp/pull/34) Create LICENSE ([@ScottWeinstein](https://github.com/ScottWeinstein))
|
|
222
|
-
|
|
223
|
-
#### Committers: 6
|
|
224
|
-
- Bradley Farias ([@bmeck](https://github.com/bmeck))
|
|
225
|
-
- Carsten Klein ([@silkentrance](https://github.com/silkentrance))
|
|
226
|
-
- Hrvoje Šimić ([@shime](https://github.com/shime))
|
|
227
|
-
- Juwan Yoo ([@vhain](https://github.com/vhain))
|
|
228
|
-
- KARASZI István ([@raszi](https://github.com/raszi))
|
|
229
|
-
- Scott Weinstein ([@ScottWeinstein](https://github.com/ScottWeinstein))
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
## v0.0.24 (2014-07-11)
|
|
233
|
-
|
|
234
|
-
#### :rocket: Enhancement
|
|
235
|
-
* [#25](https://github.com/raszi/node-tmp/pull/25) Added removeCallback passing ([@foxel](https://github.com/foxel))
|
|
236
|
-
|
|
237
|
-
#### Committers: 1
|
|
238
|
-
- Andrey Kupreychik ([@foxel](https://github.com/foxel))
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
## v0.0.23 (2013-12-03)
|
|
242
|
-
|
|
243
|
-
#### :rocket: Enhancement
|
|
244
|
-
* [#21](https://github.com/raszi/node-tmp/pull/21) If we are not on node 0.8, don't register an uncaughtException handler ([@wibblymat](https://github.com/wibblymat))
|
|
245
|
-
|
|
246
|
-
#### Committers: 1
|
|
247
|
-
- Mat Scales ([@wibblymat](https://github.com/wibblymat))
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
## v0.0.22 (2013-11-29)
|
|
251
|
-
|
|
252
|
-
#### :rocket: Enhancement
|
|
253
|
-
* [#19](https://github.com/raszi/node-tmp/pull/19) Rethrow only on node v0.8. ([@mcollina](https://github.com/mcollina))
|
|
254
|
-
|
|
255
|
-
#### Committers: 1
|
|
256
|
-
- Matteo Collina ([@mcollina](https://github.com/mcollina))
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
## v0.0.21 (2013-08-07)
|
|
260
|
-
|
|
261
|
-
#### :bug: Bug Fix
|
|
262
|
-
* [#16](https://github.com/raszi/node-tmp/pull/16) Fix bug where we delete contents of symlinks ([@lightsofapollo](https://github.com/lightsofapollo))
|
|
263
|
-
|
|
264
|
-
#### Committers: 1
|
|
265
|
-
- James Lal ([@lightsofapollo](https://github.com/lightsofapollo))
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
## v0.0.17 (2013-04-09)
|
|
269
|
-
|
|
270
|
-
#### :rocket: Enhancement
|
|
271
|
-
* [#9](https://github.com/raszi/node-tmp/pull/9) add recursive remove option ([@oscar-broman](https://github.com/oscar-broman))
|
|
272
|
-
|
|
273
|
-
#### Committers: 1
|
|
274
|
-
- [@oscar-broman](https://github.com/oscar-broman)
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
## v0.0.14 (2012-08-26)
|
|
278
|
-
|
|
279
|
-
#### :rocket: Enhancement
|
|
280
|
-
* [#5](https://github.com/raszi/node-tmp/pull/5) Export _getTmpName for temporary file name creation ([@joscha](https://github.com/joscha))
|
|
281
|
-
|
|
282
|
-
#### Committers: 1
|
|
283
|
-
- Joscha Feth ([@joscha](https://github.com/joscha))
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
## Previous Releases < v0.0.14
|
|
287
|
-
|
|
288
|
-
- no information available
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014 KARASZI István
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
# Tmp
|
|
2
|
-
|
|
3
|
-
A simple temporary file and directory creator for [node.js.][1]
|
|
4
|
-
|
|
5
|
-
[](https://travis-ci.org/raszi/node-tmp)
|
|
6
|
-
[](https://david-dm.org/raszi/node-tmp)
|
|
7
|
-
[](https://badge.fury.io/js/tmp)
|
|
8
|
-
[](https://raszi.github.io/node-tmp/)
|
|
9
|
-
[](https://snyk.io/test/npm/tmp)
|
|
10
|
-
|
|
11
|
-
## About
|
|
12
|
-
|
|
13
|
-
This is a [widely used library][2] to create temporary files and directories
|
|
14
|
-
in a [node.js][1] environment.
|
|
15
|
-
|
|
16
|
-
Tmp offers both an asynchronous and a synchronous API. For all API calls, all
|
|
17
|
-
the parameters are optional. There also exists a promisified version of the
|
|
18
|
-
API, see [tmp-promise][5].
|
|
19
|
-
|
|
20
|
-
Tmp uses crypto for determining random file names, or, when using templates,
|
|
21
|
-
a six letter random identifier. And just in case that you do not have that much
|
|
22
|
-
entropy left on your system, Tmp will fall back to pseudo random numbers.
|
|
23
|
-
|
|
24
|
-
You can set whether you want to remove the temporary file on process exit or
|
|
25
|
-
not.
|
|
26
|
-
|
|
27
|
-
If you do not want to store your temporary directories and files in the
|
|
28
|
-
standard OS temporary directory, then you are free to override that as well.
|
|
29
|
-
|
|
30
|
-
## An Important Note on Compatibility
|
|
31
|
-
|
|
32
|
-
See the [CHANGELOG](./CHANGELOG.md) for more information.
|
|
33
|
-
|
|
34
|
-
### Version 0.1.0
|
|
35
|
-
|
|
36
|
-
Since version 0.1.0, all support for node versions < 0.10.0 has been dropped.
|
|
37
|
-
|
|
38
|
-
Most importantly, any support for earlier versions of node-tmp was also dropped.
|
|
39
|
-
|
|
40
|
-
If you still require node versions < 0.10.0, then you must limit your node-tmp
|
|
41
|
-
dependency to versions below 0.1.0.
|
|
42
|
-
|
|
43
|
-
### Version 0.0.33
|
|
44
|
-
|
|
45
|
-
Since version 0.0.33, all support for node versions < 0.8 has been dropped.
|
|
46
|
-
|
|
47
|
-
If you still require node version 0.8, then you must limit your node-tmp
|
|
48
|
-
dependency to version 0.0.33.
|
|
49
|
-
|
|
50
|
-
For node versions < 0.8 you must limit your node-tmp dependency to
|
|
51
|
-
versions < 0.0.33.
|
|
52
|
-
|
|
53
|
-
## How to install
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install tmp
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
Please also check [API docs][4].
|
|
62
|
-
|
|
63
|
-
### Asynchronous file creation
|
|
64
|
-
|
|
65
|
-
Simple temporary file creation, the file will be closed and unlinked on process exit.
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
const tmp = require('tmp');
|
|
69
|
-
|
|
70
|
-
tmp.file(function _tempFileCreated(err, path, fd, cleanupCallback) {
|
|
71
|
-
if (err) throw err;
|
|
72
|
-
|
|
73
|
-
console.log('File: ', path);
|
|
74
|
-
console.log('Filedescriptor: ', fd);
|
|
75
|
-
|
|
76
|
-
// If we don't need the file anymore we could manually call the cleanupCallback
|
|
77
|
-
// But that is not necessary if we didn't pass the keep option because the library
|
|
78
|
-
// will clean after itself.
|
|
79
|
-
cleanupCallback();
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Synchronous file creation
|
|
84
|
-
|
|
85
|
-
A synchronous version of the above.
|
|
86
|
-
|
|
87
|
-
```javascript
|
|
88
|
-
const tmp = require('tmp');
|
|
89
|
-
|
|
90
|
-
const tmpobj = tmp.fileSync();
|
|
91
|
-
console.log('File: ', tmpobj.name);
|
|
92
|
-
console.log('Filedescriptor: ', tmpobj.fd);
|
|
93
|
-
|
|
94
|
-
// If we don't need the file anymore we could manually call the removeCallback
|
|
95
|
-
// But that is not necessary if we didn't pass the keep option because the library
|
|
96
|
-
// will clean after itself.
|
|
97
|
-
tmpobj.removeCallback();
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Note that this might throw an exception if either the maximum limit of retries
|
|
101
|
-
for creating a temporary name fails, or, in case that you do not have the permission
|
|
102
|
-
to write to the directory where the temporary file should be created in.
|
|
103
|
-
|
|
104
|
-
### Asynchronous directory creation
|
|
105
|
-
|
|
106
|
-
Simple temporary directory creation, it will be removed on process exit.
|
|
107
|
-
|
|
108
|
-
If the directory still contains items on process exit, then it won't be removed.
|
|
109
|
-
|
|
110
|
-
```javascript
|
|
111
|
-
const tmp = require('tmp');
|
|
112
|
-
|
|
113
|
-
tmp.dir(function _tempDirCreated(err, path, cleanupCallback) {
|
|
114
|
-
if (err) throw err;
|
|
115
|
-
|
|
116
|
-
console.log('Dir: ', path);
|
|
117
|
-
|
|
118
|
-
// Manual cleanup
|
|
119
|
-
cleanupCallback();
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
If you want to cleanup the directory even when there are entries in it, then
|
|
124
|
-
you can pass the `unsafeCleanup` option when creating it.
|
|
125
|
-
|
|
126
|
-
### Synchronous directory creation
|
|
127
|
-
|
|
128
|
-
A synchronous version of the above.
|
|
129
|
-
|
|
130
|
-
```javascript
|
|
131
|
-
const tmp = require('tmp');
|
|
132
|
-
|
|
133
|
-
const tmpobj = tmp.dirSync();
|
|
134
|
-
console.log('Dir: ', tmpobj.name);
|
|
135
|
-
// Manual cleanup
|
|
136
|
-
tmpobj.removeCallback();
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Note that this might throw an exception if either the maximum limit of retries
|
|
140
|
-
for creating a temporary name fails, or, in case that you do not have the permission
|
|
141
|
-
to write to the directory where the temporary directory should be created in.
|
|
142
|
-
|
|
143
|
-
### Asynchronous filename generation
|
|
144
|
-
|
|
145
|
-
It is possible with this library to generate a unique filename in the specified
|
|
146
|
-
directory.
|
|
147
|
-
|
|
148
|
-
```javascript
|
|
149
|
-
const tmp = require('tmp');
|
|
150
|
-
|
|
151
|
-
tmp.tmpName(function _tempNameGenerated(err, path) {
|
|
152
|
-
if (err) throw err;
|
|
153
|
-
|
|
154
|
-
console.log('Created temporary filename: ', path);
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Synchronous filename generation
|
|
159
|
-
|
|
160
|
-
A synchronous version of the above.
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
const tmp = require('tmp');
|
|
164
|
-
|
|
165
|
-
const name = tmp.tmpNameSync();
|
|
166
|
-
console.log('Created temporary filename: ', name);
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Advanced usage
|
|
170
|
-
|
|
171
|
-
### Asynchronous file creation
|
|
172
|
-
|
|
173
|
-
Creates a file with mode `0644`, prefix will be `prefix-` and postfix will be `.txt`.
|
|
174
|
-
|
|
175
|
-
```javascript
|
|
176
|
-
const tmp = require('tmp');
|
|
177
|
-
|
|
178
|
-
tmp.file({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' }, function _tempFileCreated(err, path, fd) {
|
|
179
|
-
if (err) throw err;
|
|
180
|
-
|
|
181
|
-
console.log('File: ', path);
|
|
182
|
-
console.log('Filedescriptor: ', fd);
|
|
183
|
-
});
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Synchronous file creation
|
|
187
|
-
|
|
188
|
-
A synchronous version of the above.
|
|
189
|
-
|
|
190
|
-
```javascript
|
|
191
|
-
const tmp = require('tmp');
|
|
192
|
-
|
|
193
|
-
const tmpobj = tmp.fileSync({ mode: 0o644, prefix: 'prefix-', postfix: '.txt' });
|
|
194
|
-
console.log('File: ', tmpobj.name);
|
|
195
|
-
console.log('Filedescriptor: ', tmpobj.fd);
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Controlling the Descriptor
|
|
199
|
-
|
|
200
|
-
As a side effect of creating a unique file `tmp` gets a file descriptor that is
|
|
201
|
-
returned to the user as the `fd` parameter. The descriptor may be used by the
|
|
202
|
-
application and is closed when the `removeCallback` is invoked.
|
|
203
|
-
|
|
204
|
-
In some use cases the application does not need the descriptor, needs to close it
|
|
205
|
-
without removing the file, or needs to remove the file without closing the
|
|
206
|
-
descriptor. Two options control how the descriptor is managed:
|
|
207
|
-
|
|
208
|
-
* `discardDescriptor` - if `true` causes `tmp` to close the descriptor after the file
|
|
209
|
-
is created. In this case the `fd` parameter is undefined.
|
|
210
|
-
* `detachDescriptor` - if `true` causes `tmp` to return the descriptor in the `fd`
|
|
211
|
-
parameter, but it is the application's responsibility to close it when it is no
|
|
212
|
-
longer needed.
|
|
213
|
-
|
|
214
|
-
```javascript
|
|
215
|
-
const tmp = require('tmp');
|
|
216
|
-
|
|
217
|
-
tmp.file({ discardDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
|
|
218
|
-
if (err) throw err;
|
|
219
|
-
// fd will be undefined, allowing application to use fs.createReadStream(path)
|
|
220
|
-
// without holding an unused descriptor open.
|
|
221
|
-
});
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
```javascript
|
|
225
|
-
const tmp = require('tmp');
|
|
226
|
-
|
|
227
|
-
tmp.file({ detachDescriptor: true }, function _tempFileCreated(err, path, fd, cleanupCallback) {
|
|
228
|
-
if (err) throw err;
|
|
229
|
-
|
|
230
|
-
cleanupCallback();
|
|
231
|
-
// Application can store data through fd here; the space used will automatically
|
|
232
|
-
// be reclaimed by the operating system when the descriptor is closed or program
|
|
233
|
-
// terminates.
|
|
234
|
-
});
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Asynchronous directory creation
|
|
238
|
-
|
|
239
|
-
Creates a directory with mode `0755`, prefix will be `myTmpDir_`.
|
|
240
|
-
|
|
241
|
-
```javascript
|
|
242
|
-
const tmp = require('tmp');
|
|
243
|
-
|
|
244
|
-
tmp.dir({ mode: 0o750, prefix: 'myTmpDir_' }, function _tempDirCreated(err, path) {
|
|
245
|
-
if (err) throw err;
|
|
246
|
-
|
|
247
|
-
console.log('Dir: ', path);
|
|
248
|
-
});
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Synchronous directory creation
|
|
252
|
-
|
|
253
|
-
Again, a synchronous version of the above.
|
|
254
|
-
|
|
255
|
-
```javascript
|
|
256
|
-
const tmp = require('tmp');
|
|
257
|
-
|
|
258
|
-
const tmpobj = tmp.dirSync({ mode: 0750, prefix: 'myTmpDir_' });
|
|
259
|
-
console.log('Dir: ', tmpobj.name);
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### mkstemp like, asynchronously
|
|
263
|
-
|
|
264
|
-
Creates a new temporary directory with mode `0700` and filename like `/tmp/tmp-nk2J1u`.
|
|
265
|
-
|
|
266
|
-
IMPORTANT NOTE: template no longer accepts a path. Use the dir option instead if you
|
|
267
|
-
require tmp to create your temporary filesystem object in a different place than the
|
|
268
|
-
default `tmp.tmpdir`.
|
|
269
|
-
|
|
270
|
-
```javascript
|
|
271
|
-
const tmp = require('tmp');
|
|
272
|
-
|
|
273
|
-
tmp.dir({ template: 'tmp-XXXXXX' }, function _tempDirCreated(err, path) {
|
|
274
|
-
if (err) throw err;
|
|
275
|
-
|
|
276
|
-
console.log('Dir: ', path);
|
|
277
|
-
});
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### mkstemp like, synchronously
|
|
281
|
-
|
|
282
|
-
This will behave similarly to the asynchronous version.
|
|
283
|
-
|
|
284
|
-
```javascript
|
|
285
|
-
const tmp = require('tmp');
|
|
286
|
-
|
|
287
|
-
const tmpobj = tmp.dirSync({ template: 'tmp-XXXXXX' });
|
|
288
|
-
console.log('Dir: ', tmpobj.name);
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Asynchronous filename generation
|
|
292
|
-
|
|
293
|
-
Using `tmpName()` you can create temporary file names asynchronously.
|
|
294
|
-
The function accepts all standard options, e.g. `prefix`, `postfix`, `dir`, and so on.
|
|
295
|
-
|
|
296
|
-
You can also leave out the options altogether and just call the function with a callback as first parameter.
|
|
297
|
-
|
|
298
|
-
```javascript
|
|
299
|
-
const tmp = require('tmp');
|
|
300
|
-
|
|
301
|
-
const options = {};
|
|
302
|
-
|
|
303
|
-
tmp.tmpName(options, function _tempNameGenerated(err, path) {
|
|
304
|
-
if (err) throw err;
|
|
305
|
-
|
|
306
|
-
console.log('Created temporary filename: ', path);
|
|
307
|
-
});
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Synchronous filename generation
|
|
311
|
-
|
|
312
|
-
The `tmpNameSync()` function works similarly to `tmpName()`.
|
|
313
|
-
Again, you can leave out the options altogether and just invoke the function without any parameters.
|
|
314
|
-
|
|
315
|
-
```javascript
|
|
316
|
-
const tmp = require('tmp');
|
|
317
|
-
const options = {};
|
|
318
|
-
const tmpname = tmp.tmpNameSync(options);
|
|
319
|
-
console.log('Created temporary filename: ', tmpname);
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
## Graceful cleanup
|
|
323
|
-
|
|
324
|
-
If graceful cleanup is set, tmp will remove all controlled temporary objects on process exit, otherwise the
|
|
325
|
-
temporary objects will remain in place, waiting to be cleaned up on system restart or otherwise scheduled temporary
|
|
326
|
-
object removal.
|
|
327
|
-
|
|
328
|
-
To enforce this, you can call the `setGracefulCleanup()` method:
|
|
329
|
-
|
|
330
|
-
```javascript
|
|
331
|
-
const tmp = require('tmp');
|
|
332
|
-
|
|
333
|
-
tmp.setGracefulCleanup();
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## Options
|
|
337
|
-
|
|
338
|
-
All options are optional :)
|
|
339
|
-
|
|
340
|
-
* `name`: a fixed name that overrides random name generation, the name must be relative and must not contain path segments
|
|
341
|
-
* `mode`: the file mode to create with, falls back to `0o600` on file creation and `0o700` on directory creation
|
|
342
|
-
* `prefix`: the optional prefix, defaults to `tmp`
|
|
343
|
-
* `postfix`: the optional postfix
|
|
344
|
-
* `template`: [`mkstemp`][3] like filename template, no default, can be either an absolute or a relative path that resolves
|
|
345
|
-
to a relative path of the system's default temporary directory, must include `XXXXXX` once for random name generation, e.g.
|
|
346
|
-
'foo/bar/XXXXXX'. Absolute paths are also fine as long as they are relative to os.tmpdir().
|
|
347
|
-
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
|
|
348
|
-
as tmp will not check the availability of the path, nor will it establish the requested path for you.
|
|
349
|
-
* `dir`: the optional temporary directory that must be relative to the system's default temporary directory.
|
|
350
|
-
absolute paths are fine as long as they point to a location under the system's default temporary directory.
|
|
351
|
-
Any directories along the so specified path must exist, otherwise a ENOENT error will be thrown upon access,
|
|
352
|
-
as tmp will not check the availability of the path, nor will it establish the requested path for you.
|
|
353
|
-
* `tmpdir`: allows you to override the system's root tmp directory
|
|
354
|
-
* `tries`: how many times should the function try to get a unique filename before giving up, default `3`
|
|
355
|
-
* `keep`: signals that the temporary file or directory should not be deleted on exit, default is `false`
|
|
356
|
-
* In order to clean up, you will have to call the provided `cleanupCallback` function manually.
|
|
357
|
-
* `unsafeCleanup`: recursively removes the created temporary directory, even when it's not empty. default is `false`
|
|
358
|
-
* `detachDescriptor`: detaches the file descriptor, caller is responsible for closing the file, tmp will no longer try closing the file during garbage collection
|
|
359
|
-
* `discardDescriptor`: discards the file descriptor (closes file, fd is -1), tmp will no longer try closing the file during garbage collection
|
|
360
|
-
|
|
361
|
-
[1]: http://nodejs.org/
|
|
362
|
-
[2]: https://www.npmjs.com/browse/depended/tmp
|
|
363
|
-
[3]: http://www.kernel.org/doc/man-pages/online/pages/man3/mkstemp.3.html
|
|
364
|
-
[4]: https://raszi.github.io/node-tmp/
|
|
365
|
-
[5]: https://github.com/benjamingr/tmp-promise
|