fsevents 1.0.6 → 1.0.7
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.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/node_modules/are-we-there-yet/LICENSE +5 -0
- package/node_modules/are-we-there-yet/README.md +2 -1
- package/node_modules/are-we-there-yet/README.md~ +183 -0
- package/node_modules/are-we-there-yet/package.json +10 -9
- package/node_modules/async/README.md +14 -10
- package/node_modules/async/dist/async.js +22 -18
- package/node_modules/async/dist/async.min.js +1 -1
- package/node_modules/async/lib/async.js +22 -18
- package/node_modules/async/package.json +11 -10
- package/node_modules/core-util-is/package.json +2 -1
- package/node_modules/dashdash/README.md +6 -3
- package/node_modules/dashdash/lib/dashdash.js +10 -1
- package/node_modules/dashdash/package.json +9 -8
- package/node_modules/escape-string-regexp/index.js +1 -1
- package/node_modules/escape-string-regexp/package.json +17 -15
- package/node_modules/escape-string-regexp/readme.md +4 -4
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
- package/node_modules/graceful-fs/package.json +2 -3
- package/node_modules/isarray/package.json +2 -1
- package/node_modules/mime-db/HISTORY.md +32 -0
- package/node_modules/mime-db/README.md +1 -1
- package/node_modules/mime-db/db.json +78 -0
- package/node_modules/mime-db/package.json +15 -14
- package/node_modules/mime-types/HISTORY.md +12 -0
- package/node_modules/mime-types/package.json +11 -10
- package/node_modules/node-pre-gyp/CHANGELOG.md +8 -0
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +32 -0
- package/node_modules/node-pre-gyp/package.json +8 -8
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/.travis.yml +6 -1
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/index.js +8 -1
- package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/package.json +13 -12
- package/node_modules/rc/lib/utils.js +1 -1
- package/node_modules/rc/package.json +11 -10
- package/node_modules/readable-stream/README.md +27 -6
- package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/stream.markdown +608 -574
- package/node_modules/readable-stream/lib/_stream_duplex.js +18 -25
- package/node_modules/readable-stream/lib/_stream_passthrough.js +2 -21
- package/node_modules/readable-stream/lib/_stream_readable.js +117 -93
- package/node_modules/readable-stream/lib/_stream_transform.js +15 -27
- package/node_modules/readable-stream/lib/_stream_writable.js +140 -88
- package/node_modules/readable-stream/package.json +33 -25
- package/node_modules/readable-stream/readable.js +6 -1
- package/node_modules/rimraf/README.md +58 -0
- package/node_modules/rimraf/node_modules/glob/README.md +27 -45
- package/node_modules/rimraf/node_modules/glob/common.js +7 -26
- package/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +1 -1
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
- package/node_modules/rimraf/node_modules/glob/package.json +11 -10
- package/node_modules/rimraf/package.json +12 -11
- package/node_modules/rimraf/rimraf.js +7 -5
- package/node_modules/sshpk/bin/sshpk-conv +1 -1
- package/node_modules/sshpk/lib/dhe.js +1 -2
- package/node_modules/sshpk/lib/ssh-buffer.js +2 -1
- package/node_modules/sshpk/package.json +13 -11
- package/node_modules/string_decoder/package.json +2 -1
- package/node_modules/tar-pack/index.js +1 -2
- package/node_modules/tar-pack/node_modules/rimraf/LICENSE +12 -20
- package/node_modules/tar-pack/node_modules/rimraf/README.md +17 -4
- package/node_modules/tar-pack/node_modules/rimraf/bin.js +11 -4
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/README.md +359 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/common.js +226 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/glob.js +752 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/README.md +37 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +58 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/package.json +67 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/test.js +97 -0
- package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/package.json +3 -3
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/README.md +216 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/minimatch.js +912 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +3 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +122 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +3 -0
- package/node_modules/tar-pack/node_modules/{readable-stream/node_modules/isarray/README.md → rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md} +0 -33
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +89 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +50 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +79 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +84 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +90 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +81 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +66 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/README.md +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +58 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/once.js +21 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +70 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/index.js +20 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/package.json +78 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/readme.md +51 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/package.json +79 -0
- package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/sync.js +460 -0
- package/node_modules/tar-pack/node_modules/rimraf/package.json +28 -40
- package/node_modules/tar-pack/node_modules/rimraf/rimraf.js +138 -53
- package/node_modules/tar-pack/package.json +21 -11
- package/node_modules/tunnel-agent/index.js +2 -0
- package/node_modules/tunnel-agent/package.json +10 -9
- package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/package.json +3 -2
- package/node_modules/verror/package.json +3 -2
- package/package.json +2 -2
- package/CHANGELOG.md +0 -16
- package/node_modules/bl/node_modules/readable-stream/.npmignore +0 -5
- package/node_modules/bl/node_modules/readable-stream/LICENSE +0 -18
- package/node_modules/bl/node_modules/readable-stream/README.md +0 -36
- package/node_modules/bl/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js +0 -82
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js +0 -27
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js +0 -973
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js +0 -197
- package/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js +0 -527
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
- package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md +0 -54
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
- package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
- package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
- package/node_modules/bl/node_modules/readable-stream/package.json +0 -82
- package/node_modules/bl/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/readable.js +0 -12
- package/node_modules/bl/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/bl/node_modules/readable-stream/writable.js +0 -1
- package/node_modules/node-pre-gyp/LICENSE +0 -27
- package/node_modules/readable-stream/float.patch +0 -923
- package/node_modules/tar-pack/node_modules/readable-stream/.npmignore +0 -5
- package/node_modules/tar-pack/node_modules/readable-stream/LICENSE +0 -18
- package/node_modules/tar-pack/node_modules/readable-stream/README.md +0 -15
- package/node_modules/tar-pack/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_readable.js +0 -982
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_transform.js +0 -210
- package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_writable.js +0 -386
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/LICENSE +0 -16
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/README.md +0 -42
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +0 -23
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/package.json +0 -58
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/test.js +0 -25
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
- package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
- package/node_modules/tar-pack/node_modules/readable-stream/package.json +0 -76
- package/node_modules/tar-pack/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/readable.js +0 -8
- package/node_modules/tar-pack/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/tar-pack/node_modules/readable-stream/writable.js +0 -1
- package/node_modules/tar-pack/node_modules/rimraf/AUTHORS +0 -6
- package/node_modules/tar-pack/node_modules/rimraf/test/run.sh +0 -16
- package/node_modules/tar-pack/node_modules/rimraf/test/setup.sh +0 -47
- package/node_modules/tar-pack/node_modules/rimraf/test/test-async.js +0 -5
- package/node_modules/tar-pack/node_modules/rimraf/test/test-sync.js +0 -3
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/license.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/readme.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/test.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.travis.yml +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.zuul.yml +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/wg-meetings/2015-01-30.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/LICENSE +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/README.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits_browser.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/test.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/History.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/LICENSE +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/README.md +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/browser.js +0 -0
- /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/node.js +0 -0
@@ -1,30 +1,9 @@
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
-
// copy of this software and associated documentation files (the
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
9
|
-
// following conditions:
|
10
|
-
//
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
12
|
-
// in all copies or substantial portions of the Software.
|
13
|
-
//
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
1
|
// a duplex stream is just a stream that is both readable and writable.
|
23
2
|
// Since JS doesn't have multiple prototypal inheritance, this class
|
24
3
|
// prototypally inherits from Readable, and then parasitically from
|
25
4
|
// Writable.
|
26
5
|
|
27
|
-
|
6
|
+
'use strict';
|
28
7
|
|
29
8
|
/*<replacement>*/
|
30
9
|
var objectKeys = Object.keys || function (obj) {
|
@@ -35,6 +14,14 @@ var objectKeys = Object.keys || function (obj) {
|
|
35
14
|
/*</replacement>*/
|
36
15
|
|
37
16
|
|
17
|
+
module.exports = Duplex;
|
18
|
+
|
19
|
+
/*<replacement>*/
|
20
|
+
var processNextTick = require('process-nextick-args');
|
21
|
+
/*</replacement>*/
|
22
|
+
|
23
|
+
|
24
|
+
|
38
25
|
/*<replacement>*/
|
39
26
|
var util = require('core-util-is');
|
40
27
|
util.inherits = require('inherits');
|
@@ -45,10 +32,12 @@ var Writable = require('./_stream_writable');
|
|
45
32
|
|
46
33
|
util.inherits(Duplex, Readable);
|
47
34
|
|
48
|
-
|
35
|
+
var keys = objectKeys(Writable.prototype);
|
36
|
+
for (var v = 0; v < keys.length; v++) {
|
37
|
+
var method = keys[v];
|
49
38
|
if (!Duplex.prototype[method])
|
50
39
|
Duplex.prototype[method] = Writable.prototype[method];
|
51
|
-
}
|
40
|
+
}
|
52
41
|
|
53
42
|
function Duplex(options) {
|
54
43
|
if (!(this instanceof Duplex))
|
@@ -79,7 +68,11 @@ function onend() {
|
|
79
68
|
|
80
69
|
// no more data can be written.
|
81
70
|
// But allow more writes to happen in this tick.
|
82
|
-
|
71
|
+
processNextTick(onEndNT, this);
|
72
|
+
}
|
73
|
+
|
74
|
+
function onEndNT(self) {
|
75
|
+
self.end();
|
83
76
|
}
|
84
77
|
|
85
78
|
function forEach (xs, f) {
|
@@ -1,28 +1,9 @@
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
-
// copy of this software and associated documentation files (the
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
9
|
-
// following conditions:
|
10
|
-
//
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
12
|
-
// in all copies or substantial portions of the Software.
|
13
|
-
//
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
1
|
// a passthrough stream.
|
23
2
|
// basically just the most minimal sort of Transform stream.
|
24
3
|
// Every written chunk gets output as-is.
|
25
4
|
|
5
|
+
'use strict';
|
6
|
+
|
26
7
|
module.exports = PassThrough;
|
27
8
|
|
28
9
|
var Transform = require('./_stream_transform');
|
@@ -1,26 +1,12 @@
|
|
1
|
-
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
-
// copy of this software and associated documentation files (the
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
9
|
-
// following conditions:
|
10
|
-
//
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
12
|
-
// in all copies or substantial portions of the Software.
|
13
|
-
//
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
'use strict';
|
21
2
|
|
22
3
|
module.exports = Readable;
|
23
4
|
|
5
|
+
/*<replacement>*/
|
6
|
+
var processNextTick = require('process-nextick-args');
|
7
|
+
/*</replacement>*/
|
8
|
+
|
9
|
+
|
24
10
|
/*<replacement>*/
|
25
11
|
var isArray = require('isarray');
|
26
12
|
/*</replacement>*/
|
@@ -32,45 +18,66 @@ var Buffer = require('buffer').Buffer;
|
|
32
18
|
|
33
19
|
Readable.ReadableState = ReadableState;
|
34
20
|
|
35
|
-
var EE = require('events')
|
21
|
+
var EE = require('events');
|
36
22
|
|
37
23
|
/*<replacement>*/
|
38
|
-
|
24
|
+
var EElistenerCount = function(emitter, type) {
|
39
25
|
return emitter.listeners(type).length;
|
40
26
|
};
|
41
27
|
/*</replacement>*/
|
42
28
|
|
43
|
-
|
29
|
+
|
30
|
+
|
31
|
+
/*<replacement>*/
|
32
|
+
var Stream;
|
33
|
+
(function (){try{
|
34
|
+
Stream = require('st' + 'ream');
|
35
|
+
}catch(_){}finally{
|
36
|
+
if (!Stream)
|
37
|
+
Stream = require('events').EventEmitter;
|
38
|
+
}}())
|
39
|
+
/*</replacement>*/
|
40
|
+
|
41
|
+
var Buffer = require('buffer').Buffer;
|
44
42
|
|
45
43
|
/*<replacement>*/
|
46
44
|
var util = require('core-util-is');
|
47
45
|
util.inherits = require('inherits');
|
48
46
|
/*</replacement>*/
|
49
47
|
|
50
|
-
var StringDecoder;
|
51
48
|
|
52
49
|
|
53
50
|
/*<replacement>*/
|
54
|
-
var
|
55
|
-
|
56
|
-
|
51
|
+
var debugUtil = require('util');
|
52
|
+
var debug;
|
53
|
+
if (debugUtil && debugUtil.debuglog) {
|
54
|
+
debug = debugUtil.debuglog('stream');
|
57
55
|
} else {
|
58
56
|
debug = function () {};
|
59
57
|
}
|
60
58
|
/*</replacement>*/
|
61
59
|
|
60
|
+
var StringDecoder;
|
62
61
|
|
63
62
|
util.inherits(Readable, Stream);
|
64
63
|
|
64
|
+
var Duplex;
|
65
65
|
function ReadableState(options, stream) {
|
66
|
-
|
66
|
+
Duplex = Duplex || require('./_stream_duplex');
|
67
67
|
|
68
68
|
options = options || {};
|
69
69
|
|
70
|
+
// object stream flag. Used to make read(n) ignore n and to
|
71
|
+
// make all the buffer merging and length checks go away
|
72
|
+
this.objectMode = !!options.objectMode;
|
73
|
+
|
74
|
+
if (stream instanceof Duplex)
|
75
|
+
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
76
|
+
|
70
77
|
// the point at which it stops calling _read() to fill the buffer
|
71
78
|
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
72
79
|
var hwm = options.highWaterMark;
|
73
|
-
var defaultHwm =
|
80
|
+
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
74
81
|
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
|
75
82
|
|
76
83
|
// cast to ints.
|
@@ -97,14 +104,6 @@ function ReadableState(options, stream) {
|
|
97
104
|
this.emittedReadable = false;
|
98
105
|
this.readableListening = false;
|
99
106
|
|
100
|
-
|
101
|
-
// object stream flag. Used to make read(n) ignore n and to
|
102
|
-
// make all the buffer merging and length checks go away
|
103
|
-
this.objectMode = !!options.objectMode;
|
104
|
-
|
105
|
-
if (stream instanceof Duplex)
|
106
|
-
this.objectMode = this.objectMode || !!options.readableObjectMode;
|
107
|
-
|
108
107
|
// Crypto is kind of old and crusty. Historically, its default string
|
109
108
|
// encoding is 'binary' so we have to make this configurable.
|
110
109
|
// Everything else in the universe uses 'utf8', though.
|
@@ -130,8 +129,9 @@ function ReadableState(options, stream) {
|
|
130
129
|
}
|
131
130
|
}
|
132
131
|
|
132
|
+
var Duplex;
|
133
133
|
function Readable(options) {
|
134
|
-
|
134
|
+
Duplex = Duplex || require('./_stream_duplex');
|
135
135
|
|
136
136
|
if (!(this instanceof Readable))
|
137
137
|
return new Readable(options);
|
@@ -141,6 +141,9 @@ function Readable(options) {
|
|
141
141
|
// legacy
|
142
142
|
this.readable = true;
|
143
143
|
|
144
|
+
if (options && typeof options.read === 'function')
|
145
|
+
this._read = options.read;
|
146
|
+
|
144
147
|
Stream.call(this);
|
145
148
|
}
|
146
149
|
|
@@ -151,7 +154,7 @@ function Readable(options) {
|
|
151
154
|
Readable.prototype.push = function(chunk, encoding) {
|
152
155
|
var state = this._readableState;
|
153
156
|
|
154
|
-
if (
|
157
|
+
if (!state.objectMode && typeof chunk === 'string') {
|
155
158
|
encoding = encoding || state.defaultEncoding;
|
156
159
|
if (encoding !== state.encoding) {
|
157
160
|
chunk = new Buffer(chunk, encoding);
|
@@ -168,14 +171,17 @@ Readable.prototype.unshift = function(chunk) {
|
|
168
171
|
return readableAddChunk(this, state, chunk, '', true);
|
169
172
|
};
|
170
173
|
|
174
|
+
Readable.prototype.isPaused = function() {
|
175
|
+
return this._readableState.flowing === false;
|
176
|
+
};
|
177
|
+
|
171
178
|
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
172
179
|
var er = chunkInvalid(state, chunk);
|
173
180
|
if (er) {
|
174
181
|
stream.emit('error', er);
|
175
|
-
} else if (
|
182
|
+
} else if (chunk === null) {
|
176
183
|
state.reading = false;
|
177
|
-
|
178
|
-
onEofChunk(stream, state);
|
184
|
+
onEofChunk(stream, state);
|
179
185
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
180
186
|
if (state.ended && !addToFront) {
|
181
187
|
var e = new Error('stream.push() after EOF');
|
@@ -216,7 +222,6 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
|
216
222
|
}
|
217
223
|
|
218
224
|
|
219
|
-
|
220
225
|
// if it's past the high water mark, we can push in some more.
|
221
226
|
// Also, if we have no data yet, we can stand some
|
222
227
|
// more bytes. This is to work around cases where hwm=0,
|
@@ -240,15 +245,19 @@ Readable.prototype.setEncoding = function(enc) {
|
|
240
245
|
return this;
|
241
246
|
};
|
242
247
|
|
243
|
-
// Don't raise the hwm >
|
248
|
+
// Don't raise the hwm > 8MB
|
244
249
|
var MAX_HWM = 0x800000;
|
245
|
-
function
|
250
|
+
function computeNewHighWaterMark(n) {
|
246
251
|
if (n >= MAX_HWM) {
|
247
252
|
n = MAX_HWM;
|
248
253
|
} else {
|
249
254
|
// Get the next highest power of 2
|
250
255
|
n--;
|
251
|
-
|
256
|
+
n |= n >>> 1;
|
257
|
+
n |= n >>> 2;
|
258
|
+
n |= n >>> 4;
|
259
|
+
n |= n >>> 8;
|
260
|
+
n |= n >>> 16;
|
252
261
|
n++;
|
253
262
|
}
|
254
263
|
return n;
|
@@ -261,7 +270,7 @@ function howMuchToRead(n, state) {
|
|
261
270
|
if (state.objectMode)
|
262
271
|
return n === 0 ? 0 : 1;
|
263
272
|
|
264
|
-
if (
|
273
|
+
if (n === null || isNaN(n)) {
|
265
274
|
// only flow one buffer at a time
|
266
275
|
if (state.flowing && state.buffer.length)
|
267
276
|
return state.buffer[0].length;
|
@@ -277,15 +286,16 @@ function howMuchToRead(n, state) {
|
|
277
286
|
// power of 2, to prevent increasing it excessively in tiny
|
278
287
|
// amounts.
|
279
288
|
if (n > state.highWaterMark)
|
280
|
-
state.highWaterMark =
|
289
|
+
state.highWaterMark = computeNewHighWaterMark(n);
|
281
290
|
|
282
291
|
// don't have that much. return null, unless we've ended.
|
283
292
|
if (n > state.length) {
|
284
293
|
if (!state.ended) {
|
285
294
|
state.needReadable = true;
|
286
295
|
return 0;
|
287
|
-
} else
|
296
|
+
} else {
|
288
297
|
return state.length;
|
298
|
+
}
|
289
299
|
}
|
290
300
|
|
291
301
|
return n;
|
@@ -297,7 +307,7 @@ Readable.prototype.read = function(n) {
|
|
297
307
|
var state = this._readableState;
|
298
308
|
var nOrig = n;
|
299
309
|
|
300
|
-
if (
|
310
|
+
if (typeof n !== 'number' || n > 0)
|
301
311
|
state.emittedReadable = false;
|
302
312
|
|
303
313
|
// if we're doing read(0) to trigger a readable event, but we
|
@@ -385,7 +395,7 @@ Readable.prototype.read = function(n) {
|
|
385
395
|
else
|
386
396
|
ret = null;
|
387
397
|
|
388
|
-
if (
|
398
|
+
if (ret === null) {
|
389
399
|
state.needReadable = true;
|
390
400
|
n = 0;
|
391
401
|
}
|
@@ -401,7 +411,7 @@ Readable.prototype.read = function(n) {
|
|
401
411
|
if (nOrig !== n && state.ended && state.length === 0)
|
402
412
|
endReadable(this);
|
403
413
|
|
404
|
-
if (
|
414
|
+
if (ret !== null)
|
405
415
|
this.emit('data', ret);
|
406
416
|
|
407
417
|
return ret;
|
@@ -409,9 +419,10 @@ Readable.prototype.read = function(n) {
|
|
409
419
|
|
410
420
|
function chunkInvalid(state, chunk) {
|
411
421
|
var er = null;
|
412
|
-
if (!
|
413
|
-
|
414
|
-
|
422
|
+
if (!(Buffer.isBuffer(chunk)) &&
|
423
|
+
typeof chunk !== 'string' &&
|
424
|
+
chunk !== null &&
|
425
|
+
chunk !== undefined &&
|
415
426
|
!state.objectMode) {
|
416
427
|
er = new TypeError('Invalid non-string/buffer chunk');
|
417
428
|
}
|
@@ -420,7 +431,8 @@ function chunkInvalid(state, chunk) {
|
|
420
431
|
|
421
432
|
|
422
433
|
function onEofChunk(stream, state) {
|
423
|
-
if (state.
|
434
|
+
if (state.ended) return;
|
435
|
+
if (state.decoder) {
|
424
436
|
var chunk = state.decoder.end();
|
425
437
|
if (chunk && chunk.length) {
|
426
438
|
state.buffer.push(chunk);
|
@@ -443,9 +455,7 @@ function emitReadable(stream) {
|
|
443
455
|
debug('emitReadable', state.flowing);
|
444
456
|
state.emittedReadable = true;
|
445
457
|
if (state.sync)
|
446
|
-
|
447
|
-
emitReadable_(stream);
|
448
|
-
});
|
458
|
+
processNextTick(emitReadable_, stream);
|
449
459
|
else
|
450
460
|
emitReadable_(stream);
|
451
461
|
}
|
@@ -467,9 +477,7 @@ function emitReadable_(stream) {
|
|
467
477
|
function maybeReadMore(stream, state) {
|
468
478
|
if (!state.readingMore) {
|
469
479
|
state.readingMore = true;
|
470
|
-
|
471
|
-
maybeReadMore_(stream, state);
|
472
|
-
});
|
480
|
+
processNextTick(maybeReadMore_, stream, state);
|
473
481
|
}
|
474
482
|
}
|
475
483
|
|
@@ -520,7 +528,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
520
528
|
|
521
529
|
var endFn = doEnd ? onend : cleanup;
|
522
530
|
if (state.endEmitted)
|
523
|
-
|
531
|
+
processNextTick(endFn);
|
524
532
|
else
|
525
533
|
src.once('end', endFn);
|
526
534
|
|
@@ -544,6 +552,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
544
552
|
var ondrain = pipeOnDrain(src);
|
545
553
|
dest.on('drain', ondrain);
|
546
554
|
|
555
|
+
var cleanedUp = false;
|
547
556
|
function cleanup() {
|
548
557
|
debug('cleanup');
|
549
558
|
// cleanup event handlers once the pipe is broken
|
@@ -556,6 +565,8 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
556
565
|
src.removeListener('end', cleanup);
|
557
566
|
src.removeListener('data', ondata);
|
558
567
|
|
568
|
+
cleanedUp = true;
|
569
|
+
|
559
570
|
// if the reader is waiting for a drain event from this
|
560
571
|
// specific writer, then it would cause it to never start
|
561
572
|
// flowing again.
|
@@ -571,9 +582,16 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
571
582
|
debug('ondata');
|
572
583
|
var ret = dest.write(chunk);
|
573
584
|
if (false === ret) {
|
574
|
-
|
575
|
-
|
576
|
-
|
585
|
+
// If the user unpiped during `dest.write()`, it is possible
|
586
|
+
// to get stuck in a permanently paused state if that write
|
587
|
+
// also returned false.
|
588
|
+
if (state.pipesCount === 1 &&
|
589
|
+
state.pipes[0] === dest &&
|
590
|
+
src.listenerCount('data') === 1 &&
|
591
|
+
!cleanedUp) {
|
592
|
+
debug('false write response, pause', src._readableState.awaitDrain);
|
593
|
+
src._readableState.awaitDrain++;
|
594
|
+
}
|
577
595
|
src.pause();
|
578
596
|
}
|
579
597
|
}
|
@@ -584,7 +602,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
584
602
|
debug('onerror', er);
|
585
603
|
unpipe();
|
586
604
|
dest.removeListener('error', onerror);
|
587
|
-
if (
|
605
|
+
if (EElistenerCount(dest, 'error') === 0)
|
588
606
|
dest.emit('error', er);
|
589
607
|
}
|
590
608
|
// This is a brutally ugly hack to make sure that our error handler
|
@@ -597,7 +615,6 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|
597
615
|
dest._events.error = [onerror, dest._events.error];
|
598
616
|
|
599
617
|
|
600
|
-
|
601
618
|
// Both close and finish should trigger unpipe, but only once.
|
602
619
|
function onclose() {
|
603
620
|
dest.removeListener('finish', onfinish);
|
@@ -634,7 +651,7 @@ function pipeOnDrain(src) {
|
|
634
651
|
debug('pipeOnDrain', state.awaitDrain);
|
635
652
|
if (state.awaitDrain)
|
636
653
|
state.awaitDrain--;
|
637
|
-
if (state.awaitDrain === 0 &&
|
654
|
+
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
|
638
655
|
state.flowing = true;
|
639
656
|
flow(src);
|
640
657
|
}
|
@@ -715,11 +732,7 @@ Readable.prototype.on = function(ev, fn) {
|
|
715
732
|
state.emittedReadable = false;
|
716
733
|
state.needReadable = true;
|
717
734
|
if (!state.reading) {
|
718
|
-
|
719
|
-
process.nextTick(function() {
|
720
|
-
debug('readable nexttick read 0');
|
721
|
-
self.read(0);
|
722
|
-
});
|
735
|
+
processNextTick(nReadingNextTick, this);
|
723
736
|
} else if (state.length) {
|
724
737
|
emitReadable(this, state);
|
725
738
|
}
|
@@ -730,6 +743,11 @@ Readable.prototype.on = function(ev, fn) {
|
|
730
743
|
};
|
731
744
|
Readable.prototype.addListener = Readable.prototype.on;
|
732
745
|
|
746
|
+
function nReadingNextTick(self) {
|
747
|
+
debug('readable nexttick read 0');
|
748
|
+
self.read(0);
|
749
|
+
}
|
750
|
+
|
733
751
|
// pause() and resume() are remnants of the legacy readable stream API
|
734
752
|
// If the user uses them, then switch into old mode.
|
735
753
|
Readable.prototype.resume = function() {
|
@@ -737,10 +755,6 @@ Readable.prototype.resume = function() {
|
|
737
755
|
if (!state.flowing) {
|
738
756
|
debug('resume');
|
739
757
|
state.flowing = true;
|
740
|
-
if (!state.reading) {
|
741
|
-
debug('resume read 0');
|
742
|
-
this.read(0);
|
743
|
-
}
|
744
758
|
resume(this, state);
|
745
759
|
}
|
746
760
|
return this;
|
@@ -749,13 +763,16 @@ Readable.prototype.resume = function() {
|
|
749
763
|
function resume(stream, state) {
|
750
764
|
if (!state.resumeScheduled) {
|
751
765
|
state.resumeScheduled = true;
|
752
|
-
|
753
|
-
resume_(stream, state);
|
754
|
-
});
|
766
|
+
processNextTick(resume_, stream, state);
|
755
767
|
}
|
756
768
|
}
|
757
769
|
|
758
770
|
function resume_(stream, state) {
|
771
|
+
if (!state.reading) {
|
772
|
+
debug('resume read 0');
|
773
|
+
stream.read(0);
|
774
|
+
}
|
775
|
+
|
759
776
|
state.resumeScheduled = false;
|
760
777
|
stream.emit('resume');
|
761
778
|
flow(stream);
|
@@ -806,7 +823,11 @@ Readable.prototype.wrap = function(stream) {
|
|
806
823
|
debug('wrapped data');
|
807
824
|
if (state.decoder)
|
808
825
|
chunk = state.decoder.write(chunk);
|
809
|
-
|
826
|
+
|
827
|
+
// don't skip over falsy values in objectMode
|
828
|
+
if (state.objectMode && (chunk === null || chunk === undefined))
|
829
|
+
return;
|
830
|
+
else if (!state.objectMode && (!chunk || !chunk.length))
|
810
831
|
return;
|
811
832
|
|
812
833
|
var ret = self.push(chunk);
|
@@ -819,10 +840,10 @@ Readable.prototype.wrap = function(stream) {
|
|
819
840
|
// proxy all the other methods.
|
820
841
|
// important when wrapping filters and duplexes.
|
821
842
|
for (var i in stream) {
|
822
|
-
if (
|
843
|
+
if (this[i] === undefined && typeof stream[i] === 'function') {
|
823
844
|
this[i] = function(method) { return function() {
|
824
845
|
return stream[method].apply(stream, arguments);
|
825
|
-
}}(i);
|
846
|
+
}; }(i);
|
826
847
|
}
|
827
848
|
}
|
828
849
|
|
@@ -846,7 +867,6 @@ Readable.prototype.wrap = function(stream) {
|
|
846
867
|
};
|
847
868
|
|
848
869
|
|
849
|
-
|
850
870
|
// exposed for testing purposes only.
|
851
871
|
Readable._fromList = fromList;
|
852
872
|
|
@@ -871,6 +891,8 @@ function fromList(n, state) {
|
|
871
891
|
// read it all, truncate the array.
|
872
892
|
if (stringMode)
|
873
893
|
ret = list.join('');
|
894
|
+
else if (list.length === 1)
|
895
|
+
ret = list[0];
|
874
896
|
else
|
875
897
|
ret = Buffer.concat(list, length);
|
876
898
|
list.length = 0;
|
@@ -926,14 +948,16 @@ function endReadable(stream) {
|
|
926
948
|
|
927
949
|
if (!state.endEmitted) {
|
928
950
|
state.ended = true;
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
951
|
+
processNextTick(endReadableNT, state, stream);
|
952
|
+
}
|
953
|
+
}
|
954
|
+
|
955
|
+
function endReadableNT(state, stream) {
|
956
|
+
// Check that we didn't get one last unshift.
|
957
|
+
if (!state.endEmitted && state.length === 0) {
|
958
|
+
state.endEmitted = true;
|
959
|
+
stream.readable = false;
|
960
|
+
stream.emit('end');
|
937
961
|
}
|
938
962
|
}
|
939
963
|
|
@@ -1,25 +1,3 @@
|
|
1
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
4
|
-
// copy of this software and associated documentation files (the
|
5
|
-
// "Software"), to deal in the Software without restriction, including
|
6
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
8
|
-
// persons to whom the Software is furnished to do so, subject to the
|
9
|
-
// following conditions:
|
10
|
-
//
|
11
|
-
// The above copyright notice and this permission notice shall be included
|
12
|
-
// in all copies or substantial portions of the Software.
|
13
|
-
//
|
14
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
15
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
17
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
18
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
19
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
20
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
22
|
-
|
23
1
|
// a transform stream is a readable/writable stream where you do
|
24
2
|
// something with the data. Sometimes it's called a "filter",
|
25
3
|
// but that's not a great name for it, since that implies a thing where
|
@@ -62,6 +40,8 @@
|
|
62
40
|
// would be consumed, and then the rest would wait (un-transformed) until
|
63
41
|
// the results of the previous transformed chunk were consumed.
|
64
42
|
|
43
|
+
'use strict';
|
44
|
+
|
65
45
|
module.exports = Transform;
|
66
46
|
|
67
47
|
var Duplex = require('./_stream_duplex');
|
@@ -74,7 +54,7 @@ util.inherits = require('inherits');
|
|
74
54
|
util.inherits(Transform, Duplex);
|
75
55
|
|
76
56
|
|
77
|
-
function TransformState(
|
57
|
+
function TransformState(stream) {
|
78
58
|
this.afterTransform = function(er, data) {
|
79
59
|
return afterTransform(stream, er, data);
|
80
60
|
};
|
@@ -97,7 +77,7 @@ function afterTransform(stream, er, data) {
|
|
97
77
|
ts.writechunk = null;
|
98
78
|
ts.writecb = null;
|
99
79
|
|
100
|
-
if (
|
80
|
+
if (data !== null && data !== undefined)
|
101
81
|
stream.push(data);
|
102
82
|
|
103
83
|
if (cb)
|
@@ -117,7 +97,7 @@ function Transform(options) {
|
|
117
97
|
|
118
98
|
Duplex.call(this, options);
|
119
99
|
|
120
|
-
this._transformState = new TransformState(
|
100
|
+
this._transformState = new TransformState(this);
|
121
101
|
|
122
102
|
// when the writable side finishes, then flush out anything remaining.
|
123
103
|
var stream = this;
|
@@ -130,8 +110,16 @@ function Transform(options) {
|
|
130
110
|
// sync guard flag.
|
131
111
|
this._readableState.sync = false;
|
132
112
|
|
113
|
+
if (options) {
|
114
|
+
if (typeof options.transform === 'function')
|
115
|
+
this._transform = options.transform;
|
116
|
+
|
117
|
+
if (typeof options.flush === 'function')
|
118
|
+
this._flush = options.flush;
|
119
|
+
}
|
120
|
+
|
133
121
|
this.once('prefinish', function() {
|
134
|
-
if (
|
122
|
+
if (typeof this._flush === 'function')
|
135
123
|
this._flush(function(er) {
|
136
124
|
done(stream, er);
|
137
125
|
});
|
@@ -179,7 +167,7 @@ Transform.prototype._write = function(chunk, encoding, cb) {
|
|
179
167
|
Transform.prototype._read = function(n) {
|
180
168
|
var ts = this._transformState;
|
181
169
|
|
182
|
-
if (
|
170
|
+
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
183
171
|
ts.transforming = true;
|
184
172
|
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
185
173
|
} else {
|