angular-slickgrid 4.1.4 → 4.2.2
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 +182 -180
- package/app/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +2 -2
- package/app/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -2
- package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +15 -12
- package/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +1 -3
- package/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +7 -10
- package/esm2020/app/modules/angular-slickgrid/services/angularUtil.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/translater.service.mjs +3 -3
- package/fesm2015/angular-slickgrid.mjs +32 -34
- package/fesm2015/angular-slickgrid.mjs.map +1 -1
- package/fesm2020/angular-slickgrid.mjs +32 -34
- package/fesm2020/angular-slickgrid.mjs.map +1 -1
- package/{angular-slickgrid.d.ts → index.d.ts} +0 -0
- package/package.json +14 -15
- package/test/cypress/node_modules/@cypress/request/README.md +1038 -0
- package/test/cypress/node_modules/@cypress/xvfb/README.md +48 -0
- package/test/cypress/node_modules/@cypress/xvfb/node_modules/debug/README.md +437 -0
- package/test/cypress/node_modules/@types/node/README.md +16 -0
- package/test/cypress/node_modules/@types/sinonjs__fake-timers/README.md +16 -0
- package/test/cypress/node_modules/@types/sizzle/README.md +16 -0
- package/test/cypress/node_modules/@types/yauzl/README.md +16 -0
- package/test/cypress/node_modules/@types/yauzl/node_modules/@types/node/README.md +16 -0
- package/test/cypress/node_modules/aggregate-error/README.md +61 -0
- package/test/cypress/node_modules/ansi-colors/README.md +315 -0
- package/test/cypress/node_modules/ansi-escapes/README.md +245 -0
- package/test/cypress/node_modules/ansi-regex/README.md +78 -0
- package/test/cypress/node_modules/ansi-styles/README.md +152 -0
- package/test/cypress/node_modules/arch/README.md +71 -0
- package/test/cypress/node_modules/asn1/README.md +50 -0
- package/test/cypress/node_modules/assert-plus/README.md +162 -0
- package/test/cypress/node_modules/astral-regex/README.md +46 -0
- package/test/cypress/node_modules/async/README.md +60 -0
- package/test/cypress/node_modules/asynckit/README.md +233 -0
- package/test/cypress/node_modules/at-least-node/README.md +25 -0
- package/test/cypress/node_modules/aws-sign2/README.md +4 -0
- package/test/cypress/node_modules/aws4/README.md +183 -0
- package/test/cypress/node_modules/balanced-match/README.md +91 -0
- package/test/cypress/node_modules/base64-js/README.md +34 -0
- package/test/cypress/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/test/cypress/node_modules/blob-util/README.md +623 -0
- package/test/cypress/node_modules/bluebird/README.md +57 -0
- package/test/cypress/node_modules/brace-expansion/README.md +129 -0
- package/test/cypress/node_modules/buffer/README.md +410 -0
- package/test/cypress/node_modules/buffer-crc32/README.md +47 -0
- package/test/cypress/node_modules/cachedir/README.md +27 -0
- package/test/cypress/node_modules/caseless/README.md +45 -0
- package/test/cypress/node_modules/chalk/README.md +293 -0
- package/test/cypress/node_modules/chalk/node_modules/supports-color/README.md +76 -0
- package/test/cypress/node_modules/check-more-types/README.md +952 -0
- package/test/cypress/node_modules/ci-info/README.md +114 -0
- package/test/cypress/node_modules/clean-stack/README.md +76 -0
- package/test/cypress/node_modules/cli-cursor/README.md +55 -0
- package/test/cypress/node_modules/cli-table3/README.md +218 -0
- package/test/cypress/node_modules/cli-truncate/README.md +139 -0
- package/test/cypress/node_modules/color-convert/README.md +68 -0
- package/test/cypress/node_modules/color-name/README.md +11 -0
- package/test/cypress/node_modules/colorette/README.md +102 -0
- package/test/cypress/node_modules/colors/README.md +221 -0
- package/test/cypress/node_modules/combined-stream/README.md +138 -0
- package/test/cypress/node_modules/commander/README.md +737 -0
- package/test/cypress/node_modules/common-tags/README.md +687 -0
- package/test/cypress/node_modules/core-util-is/README.md +3 -0
- package/test/cypress/node_modules/cross-spawn/README.md +96 -0
- package/test/cypress/node_modules/cypress/README.md +25 -0
- package/test/cypress/node_modules/cypress/mount-utils/README.md +14 -0
- package/test/cypress/node_modules/cypress/react/README.md +414 -0
- package/test/cypress/node_modules/cypress/vue/README.md +678 -0
- package/test/cypress/node_modules/cypress/vue2/README.md +693 -0
- package/test/cypress/node_modules/dashdash/README.md +574 -0
- package/test/cypress/node_modules/dayjs/README.md +128 -0
- package/test/cypress/node_modules/debug/README.md +455 -0
- package/test/cypress/node_modules/delayed-stream/README.md +141 -0
- package/test/cypress/node_modules/ecc-jsbn/README.md +8 -0
- package/test/cypress/node_modules/emoji-regex/README.md +73 -0
- package/test/cypress/node_modules/end-of-stream/README.md +54 -0
- package/test/cypress/node_modules/enquirer/README.md +1752 -0
- package/test/cypress/node_modules/escape-string-regexp/README.md +27 -0
- package/test/cypress/node_modules/eventemitter2/README.md +809 -0
- package/test/cypress/node_modules/execa/README.md +656 -0
- package/test/cypress/node_modules/executable/README.md +64 -0
- package/test/cypress/node_modules/extend/README.md +81 -0
- package/test/cypress/node_modules/extract-zip/README.md +57 -0
- package/test/cypress/node_modules/extract-zip/node_modules/debug/README.md +455 -0
- package/test/cypress/node_modules/extsprintf/README.md +46 -0
- package/test/cypress/node_modules/fd-slicer/README.md +199 -0
- package/test/cypress/node_modules/figures/README.md +139 -0
- package/test/cypress/node_modules/forever-agent/README.md +4 -0
- package/test/cypress/node_modules/form-data/README.md +234 -0
- package/test/cypress/node_modules/fs-extra/README.md +264 -0
- package/test/cypress/node_modules/fs.realpath/README.md +33 -0
- package/test/cypress/node_modules/get-stream/README.md +124 -0
- package/test/cypress/node_modules/getos/README.md +79 -0
- package/test/cypress/node_modules/getpass/README.md +32 -0
- package/test/cypress/node_modules/glob/README.md +375 -0
- package/test/cypress/node_modules/global-dirs/README.md +72 -0
- package/test/cypress/node_modules/graceful-fs/README.md +133 -0
- package/test/cypress/node_modules/has-flag/README.md +89 -0
- package/test/cypress/node_modules/http-signature/README.md +80 -0
- package/test/cypress/node_modules/human-signals/README.md +155 -0
- package/test/cypress/node_modules/ieee754/README.md +51 -0
- package/test/cypress/node_modules/indent-string/README.md +70 -0
- package/test/cypress/node_modules/inflight/README.md +37 -0
- package/test/cypress/node_modules/inherits/README.md +42 -0
- package/test/cypress/node_modules/ini/README.md +102 -0
- package/test/cypress/node_modules/is-ci/README.md +50 -0
- package/test/cypress/node_modules/is-fullwidth-code-point/README.md +39 -0
- package/test/cypress/node_modules/is-installed-globally/README.md +31 -0
- package/test/cypress/node_modules/is-path-inside/README.md +63 -0
- package/test/cypress/node_modules/is-stream/README.md +57 -0
- package/test/cypress/node_modules/is-typedarray/README.md +16 -0
- package/test/cypress/node_modules/isexe/README.md +51 -0
- package/test/cypress/node_modules/isstream/README.md +66 -0
- package/test/cypress/node_modules/jsbn/README.md +175 -0
- package/test/cypress/node_modules/json-schema/README.md +3 -0
- package/test/cypress/node_modules/json-stringify-safe/README.md +52 -0
- package/test/cypress/node_modules/jsonfile/README.md +205 -0
- package/test/cypress/node_modules/jsonfile/node_modules/universalify/README.md +76 -0
- package/test/cypress/node_modules/jsprim/README.md +287 -0
- package/test/cypress/node_modules/lazy-ass/README.md +269 -0
- package/test/cypress/node_modules/listr2/README.md +17 -0
- package/test/cypress/node_modules/lodash/README.md +39 -0
- package/test/cypress/node_modules/lodash.once/README.md +18 -0
- package/test/cypress/node_modules/log-symbols/README.md +51 -0
- package/test/cypress/node_modules/log-update/README.md +97 -0
- package/test/cypress/node_modules/log-update/node_modules/slice-ansi/README.md +66 -0
- package/test/cypress/node_modules/log-update/node_modules/wrap-ansi/README.md +97 -0
- package/test/cypress/node_modules/lru-cache/README.md +166 -0
- package/test/cypress/node_modules/merge-stream/README.md +78 -0
- package/test/cypress/node_modules/mime-db/README.md +102 -0
- package/test/cypress/node_modules/mime-types/README.md +123 -0
- package/test/cypress/node_modules/mimic-fn/README.md +69 -0
- package/test/cypress/node_modules/minimatch/README.md +209 -0
- package/test/cypress/node_modules/ms/README.md +60 -0
- package/test/cypress/node_modules/npm-run-path/README.md +115 -0
- package/test/cypress/node_modules/once/README.md +79 -0
- package/test/cypress/node_modules/onetime/README.md +94 -0
- package/test/cypress/node_modules/ospath/README.md +53 -0
- package/test/cypress/node_modules/p-map/README.md +89 -0
- package/test/cypress/node_modules/path-is-absolute/README.md +59 -0
- package/test/cypress/node_modules/path-key/README.md +61 -0
- package/test/cypress/node_modules/pend/README.md +41 -0
- package/test/cypress/node_modules/performance-now/README.md +30 -0
- package/test/cypress/node_modules/pify/README.md +119 -0
- package/test/cypress/node_modules/pretty-bytes/README.md +131 -0
- package/test/cypress/node_modules/proxy-from-env/README.md +131 -0
- package/test/cypress/node_modules/psl/README.md +215 -0
- package/test/cypress/node_modules/pump/README.md +65 -0
- package/test/cypress/node_modules/punycode/README.md +122 -0
- package/test/cypress/node_modules/qs/README.md +475 -0
- package/test/cypress/node_modules/request-progress/README.md +78 -0
- package/test/cypress/node_modules/restore-cursor/README.md +26 -0
- package/test/cypress/node_modules/rimraf/README.md +101 -0
- package/test/cypress/node_modules/rxjs/README.md +147 -0
- package/test/cypress/node_modules/rxjs/_esm2015/README.md +147 -0
- package/test/cypress/node_modules/rxjs/_esm5/README.md +147 -0
- package/test/cypress/node_modules/rxjs/src/README.md +147 -0
- package/test/cypress/node_modules/safe-buffer/README.md +584 -0
- package/test/cypress/node_modules/safer-buffer/README.md +156 -0
- package/test/cypress/node_modules/semver/README.md +566 -0
- package/test/cypress/node_modules/shebang-command/README.md +34 -0
- package/test/cypress/node_modules/shebang-regex/README.md +33 -0
- package/test/cypress/node_modules/signal-exit/README.md +39 -0
- package/test/cypress/node_modules/slice-ansi/README.md +72 -0
- package/test/cypress/node_modules/sshpk/README.md +804 -0
- package/test/cypress/node_modules/string-width/README.md +50 -0
- package/test/cypress/node_modules/strip-ansi/README.md +46 -0
- package/test/cypress/node_modules/strip-final-newline/README.md +30 -0
- package/test/cypress/node_modules/supports-color/README.md +77 -0
- package/test/cypress/node_modules/throttleit/README.md +32 -0
- package/test/cypress/node_modules/tmp/README.md +365 -0
- package/test/cypress/node_modules/tough-cookie/README.md +527 -0
- package/test/cypress/node_modules/tslib/README.md +142 -0
- package/test/cypress/node_modules/tunnel-agent/README.md +4 -0
- package/test/cypress/node_modules/tweetnacl/README.md +459 -0
- package/test/cypress/node_modules/type-fest/README.md +760 -0
- package/test/cypress/node_modules/universalify/README.md +76 -0
- package/test/cypress/node_modules/untildify/README.md +30 -0
- package/test/cypress/node_modules/uuid/README.md +505 -0
- package/test/cypress/node_modules/verror/README.md +528 -0
- package/test/cypress/node_modules/verror/node_modules/extsprintf/README.md +46 -0
- package/test/cypress/node_modules/which/README.md +54 -0
- package/test/cypress/node_modules/wrap-ansi/README.md +91 -0
- package/test/cypress/node_modules/wrappy/README.md +36 -0
- package/test/cypress/node_modules/yallist/README.md +204 -0
- package/test/cypress/node_modules/yauzl/README.md +658 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# string-width [](https://travis-ci.org/sindresorhus/string-width)
|
|
2
|
+
|
|
3
|
+
> Get the visual width of a string - the number of columns required to display it
|
|
4
|
+
|
|
5
|
+
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
|
6
|
+
|
|
7
|
+
Useful to be able to measure the actual width of command-line output.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
$ npm install string-width
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const stringWidth = require('string-width');
|
|
21
|
+
|
|
22
|
+
stringWidth('a');
|
|
23
|
+
//=> 1
|
|
24
|
+
|
|
25
|
+
stringWidth('古');
|
|
26
|
+
//=> 2
|
|
27
|
+
|
|
28
|
+
stringWidth('\u001B[1m古\u001B[22m');
|
|
29
|
+
//=> 2
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
|
|
35
|
+
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
|
36
|
+
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
|
37
|
+
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
<b>
|
|
44
|
+
<a href="https://tidelift.com/subscription/pkg/npm-string-width?utm_source=npm-string-width&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|
45
|
+
</b>
|
|
46
|
+
<br>
|
|
47
|
+
<sub>
|
|
48
|
+
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
49
|
+
</sub>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# strip-ansi [](https://travis-ci.org/chalk/strip-ansi)
|
|
2
|
+
|
|
3
|
+
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
$ npm install strip-ansi
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const stripAnsi = require('strip-ansi');
|
|
17
|
+
|
|
18
|
+
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
|
19
|
+
//=> 'Unicorn'
|
|
20
|
+
|
|
21
|
+
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
|
22
|
+
//=> 'Click'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## strip-ansi for enterprise
|
|
27
|
+
|
|
28
|
+
Available as part of the Tidelift Subscription.
|
|
29
|
+
|
|
30
|
+
The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
|
|
35
|
+
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
|
|
36
|
+
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
|
|
37
|
+
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
|
38
|
+
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
|
39
|
+
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Maintainers
|
|
43
|
+
|
|
44
|
+
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
45
|
+
- [Josh Junon](https://github.com/qix-)
|
|
46
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# strip-final-newline [](https://travis-ci.com/sindresorhus/strip-final-newline)
|
|
2
|
+
|
|
3
|
+
> Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from a string/buffer
|
|
4
|
+
|
|
5
|
+
Can be useful when parsing the output of, for example, `ChildProcess#execFile`, as [binaries usually output a newline at the end](https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline). Normally, you would use `stdout.trim()`, but that would also remove newlines at the start and whitespace.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
$ npm install strip-final-newline
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const stripFinalNewline = require('strip-final-newline');
|
|
19
|
+
|
|
20
|
+
stripFinalNewline('foo\nbar\n\n');
|
|
21
|
+
//=> 'foo\nbar\n'
|
|
22
|
+
|
|
23
|
+
stripFinalNewline(Buffer.from('foo\nbar\n\n')).toString();
|
|
24
|
+
//=> 'foo\nbar\n'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# supports-color
|
|
2
|
+
|
|
3
|
+
> Detect whether a terminal supports color
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ npm install supports-color
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const supportsColor = require('supports-color');
|
|
15
|
+
|
|
16
|
+
if (supportsColor.stdout) {
|
|
17
|
+
console.log('Terminal stdout supports color');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (supportsColor.stdout.has256) {
|
|
21
|
+
console.log('Terminal stdout supports 256 colors');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (supportsColor.stderr.has16m) {
|
|
25
|
+
console.log('Terminal stderr supports 16 million colors (truecolor)');
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
|
|
32
|
+
|
|
33
|
+
The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
|
|
34
|
+
|
|
35
|
+
- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
|
|
36
|
+
- `.level = 2` and `.has256 = true`: 256 color support
|
|
37
|
+
- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
|
|
38
|
+
|
|
39
|
+
### `require('supports-color').supportsColor(stream, options?)`
|
|
40
|
+
|
|
41
|
+
Additionally, `supports-color` exposes the `.supportsColor()` function that takes an arbitrary write stream (e.g. `process.stdout`) and an optional options object to (re-)evaluate color support for an arbitrary stream.
|
|
42
|
+
|
|
43
|
+
For example, `require('supports-color').stdout` is the equivalent of `require('supports-color').supportsColor(process.stdout)`.
|
|
44
|
+
|
|
45
|
+
The options object supports a single boolean property `sniffFlags`. By default it is `true`, which instructs `supportsColor()` to sniff `process.argv` for the multitude of `--color` flags (see _Info_ below). If `false`, then `process.argv` is not considered when determining color support.
|
|
46
|
+
|
|
47
|
+
## Info
|
|
48
|
+
|
|
49
|
+
It obeys the `--color` and `--no-color` CLI flags.
|
|
50
|
+
|
|
51
|
+
For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
|
52
|
+
|
|
53
|
+
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
|
54
|
+
|
|
55
|
+
## Related
|
|
56
|
+
|
|
57
|
+
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
|
|
58
|
+
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
|
59
|
+
|
|
60
|
+
## Maintainers
|
|
61
|
+
|
|
62
|
+
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
63
|
+
- [Josh Junon](https://github.com/qix-)
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
<div align="center">
|
|
68
|
+
<b>
|
|
69
|
+
<a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|
70
|
+
</b>
|
|
71
|
+
<br>
|
|
72
|
+
<sub>
|
|
73
|
+
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|
74
|
+
</sub>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
---
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
# throttle
|
|
3
|
+
|
|
4
|
+
Throttle a function
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
$ component install component/throttle
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
var throttle = require('throttle');
|
|
13
|
+
window.onresize = throttle(resize, 200);
|
|
14
|
+
|
|
15
|
+
function resize(e) {
|
|
16
|
+
console.log('height', window.innerHeight);
|
|
17
|
+
console.log('width', window.innerWidth);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### throttle(fn, wait)
|
|
23
|
+
|
|
24
|
+
Creates a function that will call `fn` at most once every `wait` milliseconds.
|
|
25
|
+
|
|
26
|
+
Supports leading and trailing invocation.
|
|
27
|
+
|
|
28
|
+
`fn` will receive last context (`this`) and last arguments passed to a throttled wrapper before `fn` was invoked.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
|
@@ -0,0 +1,365 @@
|
|
|
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
|