fsevents 1.0.15 → 1.1.1
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/fsevents.js +3 -0
- package/install.js +7 -0
- package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
- package/node_modules/abbrev/abbrev.js +0 -1
- package/node_modules/abbrev/package.json +32 -21
- package/node_modules/ansi-regex/index.js +1 -1
- package/node_modules/ansi-regex/package.json +61 -42
- package/node_modules/ansi-regex/readme.md +10 -2
- package/node_modules/ansi-styles/package.json +27 -19
- package/node_modules/aproba/README.md +33 -3
- package/node_modules/aproba/index.js +71 -30
- package/node_modules/aproba/package.json +30 -22
- package/node_modules/are-we-there-yet/package.json +14 -6
- package/node_modules/asn1/package.json +16 -8
- package/node_modules/assert-plus/package.json +16 -8
- package/node_modules/{node-uuid/LICENSE.md → asynckit/LICENSE} +1 -1
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +126 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/aws-sign2/package.json +15 -7
- package/node_modules/aws4/README.md +9 -0
- package/node_modules/aws4/aws4.js +21 -7
- package/node_modules/aws4/package.json +62 -54
- package/node_modules/balanced-match/package.json +27 -19
- package/node_modules/bcrypt-pbkdf/README.md +39 -0
- package/node_modules/bcrypt-pbkdf/index.js +556 -0
- package/node_modules/bcrypt-pbkdf/package.json +84 -0
- package/node_modules/block-stream/package.json +15 -7
- package/node_modules/boom/package.json +14 -6
- package/node_modules/brace-expansion/index.js +10 -0
- package/node_modules/brace-expansion/package.json +35 -27
- package/node_modules/buffer-shims/package.json +16 -7
- package/node_modules/caseless/package.json +18 -10
- package/node_modules/chalk/package.json +30 -22
- package/node_modules/code-point-at/index.js +3 -4
- package/node_modules/code-point-at/package.json +40 -30
- package/node_modules/code-point-at/readme.md +2 -4
- package/node_modules/combined-stream/package.json +15 -7
- package/node_modules/commander/package.json +16 -8
- package/node_modules/concat-map/package.json +30 -22
- package/node_modules/console-control-strings/package.json +15 -7
- package/node_modules/core-util-is/package.json +22 -14
- package/node_modules/cryptiles/package.json +14 -6
- package/node_modules/dashdash/CHANGES.md +364 -0
- package/node_modules/dashdash/LICENSE.txt +24 -0
- package/node_modules/dashdash/etc/dashdash.bash_completion.in +4 -3
- package/node_modules/dashdash/node_modules/assert-plus/package.json +16 -8
- package/node_modules/dashdash/package.json +33 -24
- package/node_modules/debug/package.json +20 -12
- package/node_modules/deep-extend/package.json +23 -15
- package/node_modules/delayed-stream/package.json +15 -7
- package/node_modules/delegates/package.json +14 -6
- package/node_modules/ecc-jsbn/package.json +17 -9
- package/node_modules/escape-string-regexp/package.json +20 -12
- package/node_modules/extend/package.json +16 -8
- package/node_modules/extsprintf/package.json +14 -6
- package/node_modules/forever-agent/package.json +15 -7
- package/node_modules/form-data/README.md +7 -8
- package/node_modules/form-data/lib/browser.js +1 -1
- package/node_modules/form-data/lib/form_data.js +101 -72
- package/node_modules/form-data/lib/populate.js +6 -5
- package/node_modules/form-data/package.json +68 -52
- package/node_modules/fs.realpath/package.json +19 -11
- package/node_modules/fstream/package.json +15 -7
- package/node_modules/fstream-ignore/package.json +15 -7
- package/node_modules/gauge/CHANGELOG.md +24 -0
- package/node_modules/gauge/README.md +4 -0
- package/node_modules/gauge/index.js +16 -9
- package/node_modules/gauge/package.json +37 -29
- package/node_modules/generate-function/package.json +16 -8
- package/node_modules/generate-object-property/package.json +14 -6
- package/node_modules/getpass/node_modules/assert-plus/package.json +16 -8
- package/node_modules/getpass/package.json +16 -8
- package/node_modules/glob/README.md +3 -0
- package/node_modules/glob/common.js +6 -1
- package/node_modules/glob/glob.js +23 -14
- package/node_modules/glob/package.json +29 -21
- package/node_modules/glob/sync.js +29 -11
- package/node_modules/graceful-fs/README.md +1 -1
- package/node_modules/graceful-fs/graceful-fs.js +23 -14
- package/node_modules/graceful-fs/package.json +35 -27
- package/node_modules/graceful-fs/polyfills.js +99 -21
- package/node_modules/graceful-readlink/package.json +14 -6
- package/node_modules/har-validator/package.json +16 -8
- package/node_modules/has-ansi/package.json +29 -21
- package/node_modules/has-unicode/package.json +18 -10
- package/node_modules/hawk/package.json +18 -10
- package/node_modules/hoek/package.json +14 -6
- package/node_modules/http-signature/package.json +14 -6
- package/node_modules/inflight/inflight.js +22 -12
- package/node_modules/inflight/package.json +28 -20
- package/node_modules/inherits/inherits.js +7 -1
- package/node_modules/inherits/package.json +41 -21
- package/node_modules/ini/package.json +15 -7
- package/node_modules/is-fullwidth-code-point/package.json +27 -19
- package/node_modules/is-my-json-valid/index.js +10 -0
- package/node_modules/is-my-json-valid/package.json +36 -20
- package/node_modules/is-my-json-valid/test/misc.js +24 -0
- package/node_modules/is-property/package.json +19 -11
- package/node_modules/is-typedarray/package.json +16 -8
- package/node_modules/isarray/package.json +28 -20
- package/node_modules/isstream/package.json +19 -11
- package/node_modules/jodid25519/package.json +18 -10
- package/node_modules/jsbn/index.js +8 -9
- package/node_modules/jsbn/package.json +30 -18
- package/node_modules/json-schema/lib/links.js +17 -3
- package/node_modules/json-schema/lib/validate.js +18 -5
- package/node_modules/json-schema/package.json +32 -18
- package/node_modules/json-stringify-safe/package.json +18 -10
- package/node_modules/{async/LICENSE → jsonpointer/LICENSE.md} +3 -1
- package/node_modules/jsonpointer/README.md +17 -10
- package/node_modules/jsonpointer/jsonpointer.js +73 -56
- package/node_modules/jsonpointer/package.json +47 -26
- package/node_modules/jsprim/CHANGES.md +4 -0
- package/node_modules/jsprim/package.json +25 -17
- package/node_modules/mime-db/HISTORY.md +50 -0
- package/node_modules/mime-db/db.json +126 -2
- package/node_modules/mime-db/package.json +43 -30
- package/node_modules/mime-types/HISTORY.md +19 -0
- package/node_modules/mime-types/index.js +8 -8
- package/node_modules/mime-types/package.json +32 -19
- package/node_modules/minimatch/minimatch.js +19 -20
- package/node_modules/minimatch/package.json +25 -17
- package/node_modules/minimist/package.json +24 -16
- package/node_modules/mkdirp/package.json +21 -13
- package/node_modules/ms/package.json +14 -6
- package/node_modules/node-pre-gyp/CHANGELOG.md +20 -0
- package/node_modules/node-pre-gyp/README.md +574 -0
- package/node_modules/node-pre-gyp/appveyor.yml +19 -9
- package/node_modules/node-pre-gyp/lib/install.js +31 -7
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +3 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +140 -0
- package/node_modules/node-pre-gyp/package.json +52 -48
- package/node_modules/nopt/package.json +19 -11
- package/node_modules/npmlog/CHANGELOG.md +9 -0
- package/node_modules/npmlog/README.md +7 -1
- package/node_modules/npmlog/log.js +12 -8
- package/node_modules/npmlog/package.json +30 -22
- package/node_modules/number-is-nan/package.json +39 -30
- package/node_modules/number-is-nan/readme.md +1 -3
- package/node_modules/oauth-sign/package.json +15 -7
- package/node_modules/object-assign/index.js +11 -4
- package/node_modules/object-assign/package.json +42 -30
- package/node_modules/object-assign/readme.md +8 -3
- package/node_modules/once/README.md +28 -0
- package/node_modules/once/once.js +21 -0
- package/node_modules/once/package.json +31 -20
- package/node_modules/path-is-absolute/index.js +5 -5
- package/node_modules/path-is-absolute/package.json +45 -31
- package/node_modules/path-is-absolute/readme.md +19 -11
- package/node_modules/pinkie/package.json +18 -10
- package/node_modules/pinkie-promise/package.json +18 -10
- package/node_modules/process-nextick-args/package.json +16 -8
- package/node_modules/punycode/LICENSE-MIT.txt +20 -0
- package/node_modules/punycode/README.md +176 -0
- package/node_modules/punycode/package.json +127 -0
- package/node_modules/punycode/punycode.js +533 -0
- package/node_modules/qs/.eslintrc +15 -15
- package/node_modules/qs/CHANGELOG.md +36 -0
- package/node_modules/qs/README.md +431 -0
- package/node_modules/qs/dist/qs.js +167 -67
- package/node_modules/qs/lib/formats.js +18 -0
- package/node_modules/qs/lib/index.js +6 -4
- package/node_modules/qs/lib/parse.js +31 -32
- package/node_modules/qs/lib/stringify.js +83 -20
- package/node_modules/qs/lib/utils.js +23 -7
- package/node_modules/qs/package.json +40 -30
- package/node_modules/qs/test/.eslintrc +10 -0
- package/node_modules/qs/test/index.js +2 -0
- package/node_modules/qs/test/parse.js +108 -47
- package/node_modules/qs/test/stringify.js +261 -28
- package/node_modules/qs/test/utils.js +13 -0
- package/node_modules/rc/node_modules/minimist/package.json +24 -16
- package/node_modules/rc/package.json +35 -23
- package/node_modules/readable-stream/.npmignore +1 -0
- package/node_modules/readable-stream/.travis.yml +2 -7
- package/node_modules/readable-stream/README.md +6 -2
- package/node_modules/readable-stream/lib/_stream_readable.js +158 -110
- package/node_modules/readable-stream/lib/_stream_transform.js +7 -5
- package/node_modules/readable-stream/lib/_stream_writable.js +35 -7
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +64 -0
- package/node_modules/readable-stream/package.json +34 -26
- package/node_modules/request/CHANGELOG.md +49 -18
- package/node_modules/request/README.md +3 -2
- package/node_modules/request/index.js +2 -3
- package/node_modules/request/lib/auth.js +1 -1
- package/node_modules/request/lib/helpers.js +4 -13
- package/node_modules/request/lib/multipart.js +1 -1
- package/node_modules/request/lib/oauth.js +1 -1
- package/node_modules/request/lib/redirect.js +5 -1
- package/node_modules/request/package.json +50 -31
- package/node_modules/request/request.js +84 -43
- package/node_modules/rimraf/package.json +28 -20
- package/node_modules/rimraf/rimraf.js +2 -2
- package/node_modules/semver/README.md +4 -0
- package/node_modules/semver/package.json +27 -19
- package/node_modules/semver/semver.js +14 -5
- package/node_modules/set-blocking/package.json +21 -13
- package/node_modules/signal-exit/CHANGELOG.md +10 -0
- package/node_modules/signal-exit/LICENSE.txt +2 -0
- package/node_modules/signal-exit/index.js +9 -0
- package/node_modules/signal-exit/package.json +32 -24
- package/node_modules/signal-exit/signals.js +5 -4
- package/node_modules/sntp/package.json +16 -8
- package/node_modules/sshpk/README.md +214 -3
- package/node_modules/sshpk/bin/sshpk-conv +6 -0
- package/node_modules/sshpk/lib/certificate.js +291 -0
- package/node_modules/sshpk/lib/errors.js +14 -1
- package/node_modules/sshpk/lib/fingerprint.js +28 -7
- package/node_modules/sshpk/lib/formats/openssh-cert.js +289 -0
- package/node_modules/sshpk/lib/formats/pem.js +2 -2
- package/node_modules/sshpk/lib/formats/pkcs8.js +2 -7
- package/node_modules/sshpk/lib/formats/ssh-private.js +140 -17
- package/node_modules/sshpk/lib/formats/x509-pem.js +77 -0
- package/node_modules/sshpk/lib/formats/x509.js +484 -0
- package/node_modules/sshpk/lib/identity.js +277 -0
- package/node_modules/sshpk/lib/index.js +13 -1
- package/node_modules/sshpk/lib/key.js +1 -0
- package/node_modules/sshpk/lib/signature.js +14 -6
- package/node_modules/sshpk/lib/ssh-buffer.js +24 -0
- package/node_modules/sshpk/lib/utils.js +43 -1
- package/node_modules/sshpk/node_modules/assert-plus/package.json +16 -8
- package/node_modules/sshpk/package.json +32 -22
- package/node_modules/string-width/index.js +5 -0
- package/node_modules/string-width/package.json +49 -36
- package/node_modules/string-width/readme.md +4 -3
- package/node_modules/string_decoder/package.json +19 -11
- package/node_modules/stringstream/package.json +18 -10
- package/node_modules/strip-ansi/package.json +29 -21
- package/node_modules/strip-json-comments/index.js +70 -0
- package/node_modules/strip-json-comments/package.json +49 -43
- package/node_modules/strip-json-comments/readme.md +12 -28
- package/node_modules/supports-color/package.json +26 -18
- package/node_modules/tar/package.json +19 -11
- package/node_modules/tar-pack/README.md +4 -1
- package/node_modules/tar-pack/index.js +17 -12
- package/node_modules/tar-pack/node_modules/once/LICENSE +15 -0
- package/node_modules/tar-pack/node_modules/once/README.md +51 -0
- package/node_modules/tar-pack/node_modules/once/once.js +21 -0
- package/node_modules/tar-pack/node_modules/once/package.json +96 -0
- package/node_modules/tar-pack/node_modules/readable-stream/.npmignore +8 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/.travis.yml +4 -7
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/LICENSE +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/README.md +2 -2
- package/node_modules/tar-pack/node_modules/readable-stream/doc/stream.md +2015 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/duplex.js +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_duplex.js +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_passthrough.js +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_readable.js +164 -107
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_transform.js +3 -3
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_writable.js +25 -15
- package/node_modules/tar-pack/node_modules/readable-stream/lib/internal/streams/BufferList.js +64 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/package.json +50 -30
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/passthrough.js +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/readable.js +4 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/transform.js +0 -0
- package/node_modules/{bl → tar-pack}/node_modules/readable-stream/writable.js +0 -0
- package/node_modules/tar-pack/package.json +39 -22
- package/node_modules/tar-pack/test/index.js +43 -1
- package/node_modules/tough-cookie/README.md +17 -3
- package/node_modules/tough-cookie/lib/cookie.js +6 -12
- package/node_modules/tough-cookie/package.json +50 -35
- package/node_modules/tunnel-agent/package.json +15 -7
- package/node_modules/tweetnacl/AUTHORS.md +28 -0
- package/node_modules/tweetnacl/CHANGELOG.md +93 -0
- package/node_modules/tweetnacl/LICENSE +24 -0
- package/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +20 -0
- package/node_modules/tweetnacl/README.md +57 -61
- package/node_modules/tweetnacl/nacl-fast.js +22 -52
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -2
- package/node_modules/tweetnacl/nacl.d.ts +98 -0
- package/node_modules/tweetnacl/nacl.js +21 -51
- package/node_modules/tweetnacl/nacl.min.js +1 -1
- package/node_modules/tweetnacl/package.json +47 -46
- package/node_modules/uid-number/package.json +15 -7
- package/node_modules/util-deprecate/package.json +21 -13
- package/node_modules/uuid/.npmignore +8 -0
- package/node_modules/uuid/.travis.yml +5 -0
- package/node_modules/uuid/AUTHORS +5 -0
- package/node_modules/uuid/HISTORY.md +28 -0
- package/node_modules/uuid/LICENSE.md +21 -0
- package/node_modules/uuid/README.md +132 -0
- package/node_modules/{node-uuid → uuid}/bin/uuid +0 -0
- package/node_modules/uuid/index.js +8 -0
- package/node_modules/uuid/lib/bytesToUuid.js +23 -0
- package/node_modules/uuid/lib/rng-browser.js +33 -0
- package/node_modules/uuid/lib/rng.js +10 -0
- package/node_modules/uuid/package.json +122 -0
- package/node_modules/uuid/test/mocha.opts +3 -0
- package/node_modules/uuid/test/test.js +96 -0
- package/node_modules/uuid/v1.js +103 -0
- package/node_modules/uuid/v4.js +29 -0
- package/node_modules/verror/package.json +14 -6
- package/node_modules/wide-align/package.json +19 -11
- package/node_modules/wrappy/package.json +17 -8
- package/node_modules/xtend/package.json +29 -21
- package/package.json +2 -2
- package/node_modules/async/CHANGELOG.md +0 -125
- package/node_modules/async/README.md +0 -1877
- package/node_modules/async/dist/async.js +0 -1265
- package/node_modules/async/dist/async.min.js +0 -2
- package/node_modules/async/lib/async.js +0 -1265
- package/node_modules/async/package.json +0 -149
- package/node_modules/bl/.jshintrc +0 -59
- package/node_modules/bl/.npmignore +0 -1
- package/node_modules/bl/.travis.yml +0 -13
- package/node_modules/bl/LICENSE.md +0 -13
- package/node_modules/bl/README.md +0 -200
- package/node_modules/bl/bl.js +0 -243
- package/node_modules/bl/node_modules/readable-stream/.npmignore +0 -5
- package/node_modules/bl/node_modules/readable-stream/.zuul.yml +0 -1
- package/node_modules/bl/node_modules/readable-stream/doc/stream.markdown +0 -1760
- package/node_modules/bl/package.json +0 -96
- package/node_modules/bl/test/test.js +0 -640
- package/node_modules/form-data/.dockerignore +0 -7
- package/node_modules/form-data/.editorconfig +0 -10
- package/node_modules/form-data/.eslintignore +0 -1
- package/node_modules/form-data/.eslintrc +0 -64
- package/node_modules/form-data/wercker.yml +0 -36
- package/node_modules/gauge/CHANGELOG.md~ +0 -123
- package/node_modules/gauge/README.md~ +0 -393
- package/node_modules/has-color/index.js +0 -32
- package/node_modules/has-color/package.json +0 -97
- package/node_modules/has-color/readme.md +0 -30
- package/node_modules/inherits/test.js +0 -25
- package/node_modules/jsonpointer/.travis.yml +0 -10
- package/node_modules/jsonpointer/test.js +0 -98
- package/node_modules/node-uuid/.npmignore +0 -4
- package/node_modules/node-uuid/README.md +0 -254
- package/node_modules/node-uuid/benchmark/README.md +0 -53
- package/node_modules/node-uuid/benchmark/bench.gnu +0 -174
- package/node_modules/node-uuid/benchmark/bench.sh +0 -34
- package/node_modules/node-uuid/benchmark/benchmark-native.c +0 -34
- package/node_modules/node-uuid/benchmark/benchmark.js +0 -84
- package/node_modules/node-uuid/bower.json +0 -23
- package/node_modules/node-uuid/component.json +0 -25
- package/node_modules/node-uuid/package.json +0 -105
- package/node_modules/node-uuid/test/compare_v1.js +0 -63
- package/node_modules/node-uuid/test/test.html +0 -17
- package/node_modules/node-uuid/test/test.js +0 -231
- package/node_modules/node-uuid/uuid.js +0 -272
- package/node_modules/npmlog/CHANGELOG.md~ +0 -31
- package/node_modules/qs/.jscs.json +0 -176
- package/node_modules/qs/CONTRIBUTING.md +0 -1
- package/node_modules/readable-stream/doc/stream.md +0 -1772
- package/node_modules/request/.eslintrc +0 -45
- package/node_modules/request/.npmignore +0 -6
- package/node_modules/request/.travis.yml +0 -21
- package/node_modules/request/CONTRIBUTING.md +0 -81
- package/node_modules/request/codecov.yml +0 -2
- package/node_modules/strip-json-comments/cli.js +0 -41
- package/node_modules/strip-json-comments/strip-json-comments.js +0 -73
package/node_modules/{bl → tar-pack}/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
package/node_modules/{bl → tar-pack}/node_modules/readable-stream/lib/_stream_passthrough.js
RENAMED
File without changes
|
@@ -10,15 +10,11 @@ var processNextTick = require('process-nextick-args');
|
|
10
10
|
var isArray = require('isarray');
|
11
11
|
/*</replacement>*/
|
12
12
|
|
13
|
-
/*<replacement>*/
|
14
|
-
var Buffer = require('buffer').Buffer;
|
15
|
-
/*</replacement>*/
|
16
|
-
|
17
13
|
Readable.ReadableState = ReadableState;
|
18
14
|
|
19
|
-
var EE = require('events');
|
20
|
-
|
21
15
|
/*<replacement>*/
|
16
|
+
var EE = require('events').EventEmitter;
|
17
|
+
|
22
18
|
var EElistenerCount = function (emitter, type) {
|
23
19
|
return emitter.listeners(type).length;
|
24
20
|
};
|
@@ -36,6 +32,9 @@ var Stream;
|
|
36
32
|
/*</replacement>*/
|
37
33
|
|
38
34
|
var Buffer = require('buffer').Buffer;
|
35
|
+
/*<replacement>*/
|
36
|
+
var bufferShim = require('buffer-shims');
|
37
|
+
/*</replacement>*/
|
39
38
|
|
40
39
|
/*<replacement>*/
|
41
40
|
var util = require('core-util-is');
|
@@ -44,7 +43,7 @@ util.inherits = require('inherits');
|
|
44
43
|
|
45
44
|
/*<replacement>*/
|
46
45
|
var debugUtil = require('util');
|
47
|
-
var debug =
|
46
|
+
var debug = void 0;
|
48
47
|
if (debugUtil && debugUtil.debuglog) {
|
49
48
|
debug = debugUtil.debuglog('stream');
|
50
49
|
} else {
|
@@ -52,10 +51,23 @@ if (debugUtil && debugUtil.debuglog) {
|
|
52
51
|
}
|
53
52
|
/*</replacement>*/
|
54
53
|
|
54
|
+
var BufferList = require('./internal/streams/BufferList');
|
55
55
|
var StringDecoder;
|
56
56
|
|
57
57
|
util.inherits(Readable, Stream);
|
58
58
|
|
59
|
+
function prependListener(emitter, event, fn) {
|
60
|
+
if (typeof emitter.prependListener === 'function') {
|
61
|
+
return emitter.prependListener(event, fn);
|
62
|
+
} else {
|
63
|
+
// This is a hack to make sure that our error handler is attached before any
|
64
|
+
// userland ones. NEVER DO THIS. This is here only because this code needs
|
65
|
+
// to continue to work with older versions of Node.js that do not include
|
66
|
+
// the prependListener() method. The goal is to eventually remove this hack.
|
67
|
+
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
59
71
|
var Duplex;
|
60
72
|
function ReadableState(options, stream) {
|
61
73
|
Duplex = Duplex || require('./_stream_duplex');
|
@@ -77,7 +89,10 @@ function ReadableState(options, stream) {
|
|
77
89
|
// cast to ints.
|
78
90
|
this.highWaterMark = ~ ~this.highWaterMark;
|
79
91
|
|
80
|
-
|
92
|
+
// A linked list is used to store data chunks instead of an array because the
|
93
|
+
// linked list can remove elements from the beginning faster than
|
94
|
+
// array.shift()
|
95
|
+
this.buffer = new BufferList();
|
81
96
|
this.length = 0;
|
82
97
|
this.pipes = null;
|
83
98
|
this.pipesCount = 0;
|
@@ -149,7 +164,7 @@ Readable.prototype.push = function (chunk, encoding) {
|
|
149
164
|
if (!state.objectMode && typeof chunk === 'string') {
|
150
165
|
encoding = encoding || state.defaultEncoding;
|
151
166
|
if (encoding !== state.encoding) {
|
152
|
-
chunk =
|
167
|
+
chunk = bufferShim.from(chunk, encoding);
|
153
168
|
encoding = '';
|
154
169
|
}
|
155
170
|
}
|
@@ -179,8 +194,8 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
|
179
194
|
var e = new Error('stream.push() after EOF');
|
180
195
|
stream.emit('error', e);
|
181
196
|
} else if (state.endEmitted && addToFront) {
|
182
|
-
var
|
183
|
-
stream.emit('error',
|
197
|
+
var _e = new Error('stream.unshift() after end event');
|
198
|
+
stream.emit('error', _e);
|
184
199
|
} else {
|
185
200
|
var skipAdd;
|
186
201
|
if (state.decoder && !addToFront && !encoding) {
|
@@ -240,7 +255,8 @@ function computeNewHighWaterMark(n) {
|
|
240
255
|
if (n >= MAX_HWM) {
|
241
256
|
n = MAX_HWM;
|
242
257
|
} else {
|
243
|
-
// Get the next highest power of 2
|
258
|
+
// Get the next highest power of 2 to prevent increasing hwm excessively in
|
259
|
+
// tiny amounts
|
244
260
|
n--;
|
245
261
|
n |= n >>> 1;
|
246
262
|
n |= n >>> 2;
|
@@ -252,44 +268,34 @@ function computeNewHighWaterMark(n) {
|
|
252
268
|
return n;
|
253
269
|
}
|
254
270
|
|
271
|
+
// This function is designed to be inlinable, so please take care when making
|
272
|
+
// changes to the function body.
|
255
273
|
function howMuchToRead(n, state) {
|
256
|
-
if (state.length === 0 && state.ended) return 0;
|
257
|
-
|
258
|
-
if (
|
259
|
-
|
260
|
-
|
261
|
-
// only flow one buffer at a time
|
262
|
-
if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;
|
274
|
+
if (n <= 0 || state.length === 0 && state.ended) return 0;
|
275
|
+
if (state.objectMode) return 1;
|
276
|
+
if (n !== n) {
|
277
|
+
// Only flow one buffer at a time
|
278
|
+
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
|
263
279
|
}
|
264
|
-
|
265
|
-
if (n <= 0) return 0;
|
266
|
-
|
267
|
-
// If we're asking for more than the target buffer level,
|
268
|
-
// then raise the water mark. Bump up to the next highest
|
269
|
-
// power of 2, to prevent increasing it excessively in tiny
|
270
|
-
// amounts.
|
280
|
+
// If we're asking for more than the current hwm, then raise the hwm.
|
271
281
|
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
|
272
|
-
|
273
|
-
//
|
274
|
-
if (
|
275
|
-
|
276
|
-
|
277
|
-
return 0;
|
278
|
-
} else {
|
279
|
-
return state.length;
|
280
|
-
}
|
282
|
+
if (n <= state.length) return n;
|
283
|
+
// Don't have enough
|
284
|
+
if (!state.ended) {
|
285
|
+
state.needReadable = true;
|
286
|
+
return 0;
|
281
287
|
}
|
282
|
-
|
283
|
-
return n;
|
288
|
+
return state.length;
|
284
289
|
}
|
285
290
|
|
286
291
|
// you can override either this method, or the async _read(n) below.
|
287
292
|
Readable.prototype.read = function (n) {
|
288
293
|
debug('read', n);
|
294
|
+
n = parseInt(n, 10);
|
289
295
|
var state = this._readableState;
|
290
296
|
var nOrig = n;
|
291
297
|
|
292
|
-
if (
|
298
|
+
if (n !== 0) state.emittedReadable = false;
|
293
299
|
|
294
300
|
// if we're doing read(0) to trigger a readable event, but we
|
295
301
|
// already have a bunch of data in the buffer, then just trigger
|
@@ -345,9 +351,7 @@ Readable.prototype.read = function (n) {
|
|
345
351
|
if (state.ended || state.reading) {
|
346
352
|
doRead = false;
|
347
353
|
debug('reading or ended', doRead);
|
348
|
-
}
|
349
|
-
|
350
|
-
if (doRead) {
|
354
|
+
} else if (doRead) {
|
351
355
|
debug('do read');
|
352
356
|
state.reading = true;
|
353
357
|
state.sync = true;
|
@@ -356,28 +360,29 @@ Readable.prototype.read = function (n) {
|
|
356
360
|
// call internal read method
|
357
361
|
this._read(state.highWaterMark);
|
358
362
|
state.sync = false;
|
363
|
+
// If _read pushed data synchronously, then `reading` will be false,
|
364
|
+
// and we need to re-evaluate how much data we can return to the user.
|
365
|
+
if (!state.reading) n = howMuchToRead(nOrig, state);
|
359
366
|
}
|
360
367
|
|
361
|
-
// If _read pushed data synchronously, then `reading` will be false,
|
362
|
-
// and we need to re-evaluate how much data we can return to the user.
|
363
|
-
if (doRead && !state.reading) n = howMuchToRead(nOrig, state);
|
364
|
-
|
365
368
|
var ret;
|
366
369
|
if (n > 0) ret = fromList(n, state);else ret = null;
|
367
370
|
|
368
371
|
if (ret === null) {
|
369
372
|
state.needReadable = true;
|
370
373
|
n = 0;
|
374
|
+
} else {
|
375
|
+
state.length -= n;
|
371
376
|
}
|
372
377
|
|
373
|
-
state.length
|
378
|
+
if (state.length === 0) {
|
379
|
+
// If we have nothing in the buffer, then we want to know
|
380
|
+
// as soon as we *do* get something into the buffer.
|
381
|
+
if (!state.ended) state.needReadable = true;
|
374
382
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
// If we tried to read() past the EOF, then emit end on the next tick.
|
380
|
-
if (nOrig !== n && state.ended && state.length === 0) endReadable(this);
|
383
|
+
// If we tried to read() past the EOF, then emit end on the next tick.
|
384
|
+
if (nOrig !== n && state.ended) endReadable(this);
|
385
|
+
}
|
381
386
|
|
382
387
|
if (ret !== null) this.emit('data', ret);
|
383
388
|
|
@@ -525,17 +530,25 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
|
|
525
530
|
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
|
526
531
|
}
|
527
532
|
|
533
|
+
// If the user pushes more data while we're writing to dest then we'll end up
|
534
|
+
// in ondata again. However, we only want to increase awaitDrain once because
|
535
|
+
// dest will only emit one 'drain' event for the multiple writes.
|
536
|
+
// => Introduce a guard on increasing awaitDrain.
|
537
|
+
var increasedAwaitDrain = false;
|
528
538
|
src.on('data', ondata);
|
529
539
|
function ondata(chunk) {
|
530
540
|
debug('ondata');
|
541
|
+
increasedAwaitDrain = false;
|
531
542
|
var ret = dest.write(chunk);
|
532
|
-
if (false === ret) {
|
543
|
+
if (false === ret && !increasedAwaitDrain) {
|
533
544
|
// If the user unpiped during `dest.write()`, it is possible
|
534
545
|
// to get stuck in a permanently paused state if that write
|
535
546
|
// also returned false.
|
536
|
-
|
547
|
+
// => Check whether `dest` is still a piping destination.
|
548
|
+
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
537
549
|
debug('false write response, pause', src._readableState.awaitDrain);
|
538
550
|
src._readableState.awaitDrain++;
|
551
|
+
increasedAwaitDrain = true;
|
539
552
|
}
|
540
553
|
src.pause();
|
541
554
|
}
|
@@ -549,9 +562,9 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
|
|
549
562
|
dest.removeListener('error', onerror);
|
550
563
|
if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
|
551
564
|
}
|
552
|
-
|
553
|
-
// is attached before
|
554
|
-
|
565
|
+
|
566
|
+
// Make sure our error handler is attached before userland ones.
|
567
|
+
prependListener(dest, 'error', onerror);
|
555
568
|
|
556
569
|
// Both close and finish should trigger unpipe, but only once.
|
557
570
|
function onclose() {
|
@@ -649,18 +662,14 @@ Readable.prototype.unpipe = function (dest) {
|
|
649
662
|
Readable.prototype.on = function (ev, fn) {
|
650
663
|
var res = Stream.prototype.on.call(this, ev, fn);
|
651
664
|
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
}
|
657
|
-
|
658
|
-
if (ev === 'readable' && !this._readableState.endEmitted) {
|
665
|
+
if (ev === 'data') {
|
666
|
+
// Start flowing on next tick if stream isn't explicitly paused
|
667
|
+
if (this._readableState.flowing !== false) this.resume();
|
668
|
+
} else if (ev === 'readable') {
|
659
669
|
var state = this._readableState;
|
660
|
-
if (!state.readableListening) {
|
661
|
-
state.readableListening = true;
|
670
|
+
if (!state.endEmitted && !state.readableListening) {
|
671
|
+
state.readableListening = state.needReadable = true;
|
662
672
|
state.emittedReadable = false;
|
663
|
-
state.needReadable = true;
|
664
673
|
if (!state.reading) {
|
665
674
|
processNextTick(nReadingNextTick, this);
|
666
675
|
} else if (state.length) {
|
@@ -704,6 +713,7 @@ function resume_(stream, state) {
|
|
704
713
|
}
|
705
714
|
|
706
715
|
state.resumeScheduled = false;
|
716
|
+
state.awaitDrain = 0;
|
707
717
|
stream.emit('resume');
|
708
718
|
flow(stream);
|
709
719
|
if (state.flowing && !state.reading) stream.read(0);
|
@@ -722,11 +732,7 @@ Readable.prototype.pause = function () {
|
|
722
732
|
function flow(stream) {
|
723
733
|
var state = stream._readableState;
|
724
734
|
debug('flow', state.flowing);
|
725
|
-
|
726
|
-
do {
|
727
|
-
var chunk = stream.read();
|
728
|
-
} while (null !== chunk && state.flowing);
|
729
|
-
}
|
735
|
+
while (state.flowing && stream.read() !== null) {}
|
730
736
|
}
|
731
737
|
|
732
738
|
// wrap an old-style stream as the async data source.
|
@@ -797,50 +803,101 @@ Readable._fromList = fromList;
|
|
797
803
|
|
798
804
|
// Pluck off n bytes from an array of buffers.
|
799
805
|
// Length is the combined lengths of all the buffers in the list.
|
806
|
+
// This function is designed to be inlinable, so please take care when making
|
807
|
+
// changes to the function body.
|
800
808
|
function fromList(n, state) {
|
801
|
-
|
802
|
-
|
803
|
-
var stringMode = !!state.decoder;
|
804
|
-
var objectMode = !!state.objectMode;
|
805
|
-
var ret;
|
809
|
+
// nothing buffered
|
810
|
+
if (state.length === 0) return null;
|
806
811
|
|
807
|
-
|
808
|
-
if (
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);
|
813
|
-
list.length = 0;
|
812
|
+
var ret;
|
813
|
+
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
|
814
|
+
// read it all, truncate the list
|
815
|
+
if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
|
816
|
+
state.buffer.clear();
|
814
817
|
} else {
|
815
|
-
// read
|
816
|
-
|
817
|
-
|
818
|
-
// slice is the same for buffers and strings.
|
819
|
-
var buf = list[0];
|
820
|
-
ret = buf.slice(0, n);
|
821
|
-
list[0] = buf.slice(n);
|
822
|
-
} else if (n === list[0].length) {
|
823
|
-
// first list is a perfect match
|
824
|
-
ret = list.shift();
|
825
|
-
} else {
|
826
|
-
// complex case.
|
827
|
-
// we have enough to cover it, but it spans past the first buffer.
|
828
|
-
if (stringMode) ret = '';else ret = new Buffer(n);
|
829
|
-
|
830
|
-
var c = 0;
|
831
|
-
for (var i = 0, l = list.length; i < l && c < n; i++) {
|
832
|
-
var buf = list[0];
|
833
|
-
var cpy = Math.min(n - c, buf.length);
|
818
|
+
// read part of list
|
819
|
+
ret = fromListPartial(n, state.buffer, state.decoder);
|
820
|
+
}
|
834
821
|
|
835
|
-
|
822
|
+
return ret;
|
823
|
+
}
|
836
824
|
|
837
|
-
|
825
|
+
// Extracts only enough buffered data to satisfy the amount requested.
|
826
|
+
// This function is designed to be inlinable, so please take care when making
|
827
|
+
// changes to the function body.
|
828
|
+
function fromListPartial(n, list, hasStrings) {
|
829
|
+
var ret;
|
830
|
+
if (n < list.head.data.length) {
|
831
|
+
// slice is the same for buffers and strings
|
832
|
+
ret = list.head.data.slice(0, n);
|
833
|
+
list.head.data = list.head.data.slice(n);
|
834
|
+
} else if (n === list.head.data.length) {
|
835
|
+
// first chunk is a perfect match
|
836
|
+
ret = list.shift();
|
837
|
+
} else {
|
838
|
+
// result spans more than one buffer
|
839
|
+
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
|
840
|
+
}
|
841
|
+
return ret;
|
842
|
+
}
|
838
843
|
|
839
|
-
|
844
|
+
// Copies a specified amount of characters from the list of buffered data
|
845
|
+
// chunks.
|
846
|
+
// This function is designed to be inlinable, so please take care when making
|
847
|
+
// changes to the function body.
|
848
|
+
function copyFromBufferString(n, list) {
|
849
|
+
var p = list.head;
|
850
|
+
var c = 1;
|
851
|
+
var ret = p.data;
|
852
|
+
n -= ret.length;
|
853
|
+
while (p = p.next) {
|
854
|
+
var str = p.data;
|
855
|
+
var nb = n > str.length ? str.length : n;
|
856
|
+
if (nb === str.length) ret += str;else ret += str.slice(0, n);
|
857
|
+
n -= nb;
|
858
|
+
if (n === 0) {
|
859
|
+
if (nb === str.length) {
|
860
|
+
++c;
|
861
|
+
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
862
|
+
} else {
|
863
|
+
list.head = p;
|
864
|
+
p.data = str.slice(nb);
|
840
865
|
}
|
866
|
+
break;
|
841
867
|
}
|
868
|
+
++c;
|
842
869
|
}
|
870
|
+
list.length -= c;
|
871
|
+
return ret;
|
872
|
+
}
|
843
873
|
|
874
|
+
// Copies a specified amount of bytes from the list of buffered data chunks.
|
875
|
+
// This function is designed to be inlinable, so please take care when making
|
876
|
+
// changes to the function body.
|
877
|
+
function copyFromBuffer(n, list) {
|
878
|
+
var ret = bufferShim.allocUnsafe(n);
|
879
|
+
var p = list.head;
|
880
|
+
var c = 1;
|
881
|
+
p.data.copy(ret);
|
882
|
+
n -= p.data.length;
|
883
|
+
while (p = p.next) {
|
884
|
+
var buf = p.data;
|
885
|
+
var nb = n > buf.length ? buf.length : n;
|
886
|
+
buf.copy(ret, ret.length - n, 0, nb);
|
887
|
+
n -= nb;
|
888
|
+
if (n === 0) {
|
889
|
+
if (nb === buf.length) {
|
890
|
+
++c;
|
891
|
+
if (p.next) list.head = p.next;else list.head = list.tail = null;
|
892
|
+
} else {
|
893
|
+
list.head = p;
|
894
|
+
p.data = buf.slice(nb);
|
895
|
+
}
|
896
|
+
break;
|
897
|
+
}
|
898
|
+
++c;
|
899
|
+
}
|
900
|
+
list.length -= c;
|
844
901
|
return ret;
|
845
902
|
}
|
846
903
|
|
@@ -849,7 +906,7 @@ function endReadable(stream) {
|
|
849
906
|
|
850
907
|
// If we get here before consuming all the bytes, then that is a
|
851
908
|
// bug in node. Should never happen.
|
852
|
-
if (state.length > 0) throw new Error('endReadable called on non-empty stream');
|
909
|
+
if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
853
910
|
|
854
911
|
if (!state.endEmitted) {
|
855
912
|
state.ended = true;
|
@@ -134,7 +134,7 @@ Transform.prototype.push = function (chunk, encoding) {
|
|
134
134
|
// an error, then that'll put the hurt on the whole operation. If you
|
135
135
|
// never call cb(), then you'll never get another chunk.
|
136
136
|
Transform.prototype._transform = function (chunk, encoding, cb) {
|
137
|
-
throw new Error('
|
137
|
+
throw new Error('Not implemented');
|
138
138
|
};
|
139
139
|
|
140
140
|
Transform.prototype._write = function (chunk, encoding, cb) {
|
@@ -172,9 +172,9 @@ function done(stream, er) {
|
|
172
172
|
var ws = stream._writableState;
|
173
173
|
var ts = stream._transformState;
|
174
174
|
|
175
|
-
if (ws.length) throw new Error('
|
175
|
+
if (ws.length) throw new Error('Calling transform done when ws.length != 0');
|
176
176
|
|
177
|
-
if (ts.transforming) throw new Error('
|
177
|
+
if (ts.transforming) throw new Error('Calling transform done when still transforming');
|
178
178
|
|
179
179
|
return stream.push(null);
|
180
180
|
}
|
@@ -14,10 +14,6 @@ var processNextTick = require('process-nextick-args');
|
|
14
14
|
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
|
15
15
|
/*</replacement>*/
|
16
16
|
|
17
|
-
/*<replacement>*/
|
18
|
-
var Buffer = require('buffer').Buffer;
|
19
|
-
/*</replacement>*/
|
20
|
-
|
21
17
|
Writable.WritableState = WritableState;
|
22
18
|
|
23
19
|
/*<replacement>*/
|
@@ -43,6 +39,9 @@ var Stream;
|
|
43
39
|
/*</replacement>*/
|
44
40
|
|
45
41
|
var Buffer = require('buffer').Buffer;
|
42
|
+
/*<replacement>*/
|
43
|
+
var bufferShim = require('buffer-shims');
|
44
|
+
/*</replacement>*/
|
46
45
|
|
47
46
|
util.inherits(Writable, Stream);
|
48
47
|
|
@@ -146,10 +145,9 @@ function WritableState(options, stream) {
|
|
146
145
|
// count buffered requests
|
147
146
|
this.bufferedRequestCount = 0;
|
148
147
|
|
149
|
-
//
|
150
|
-
//
|
148
|
+
// allocate the first CorkedRequest, there is always
|
149
|
+
// one allocated and free to use, and we maintain at most two
|
151
150
|
this.corkedRequestsFree = new CorkedRequest(this);
|
152
|
-
this.corkedRequestsFree.next = new CorkedRequest(this);
|
153
151
|
}
|
154
152
|
|
155
153
|
WritableState.prototype.getBuffer = function writableStateGetBuffer() {
|
@@ -196,7 +194,7 @@ function Writable(options) {
|
|
196
194
|
|
197
195
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
198
196
|
Writable.prototype.pipe = function () {
|
199
|
-
this.emit('error', new Error('Cannot pipe
|
197
|
+
this.emit('error', new Error('Cannot pipe, not readable'));
|
200
198
|
};
|
201
199
|
|
202
200
|
function writeAfterEnd(stream, cb) {
|
@@ -213,9 +211,16 @@ function writeAfterEnd(stream, cb) {
|
|
213
211
|
// how many bytes or characters.
|
214
212
|
function validChunk(stream, state, chunk, cb) {
|
215
213
|
var valid = true;
|
216
|
-
|
217
|
-
|
218
|
-
|
214
|
+
var er = false;
|
215
|
+
// Always throw error if a null is written
|
216
|
+
// if we are not in object mode then throw
|
217
|
+
// if it is not a buffer, string, or undefined.
|
218
|
+
if (chunk === null) {
|
219
|
+
er = new TypeError('May not write null values to stream');
|
220
|
+
} else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
|
221
|
+
er = new TypeError('Invalid non-string/buffer chunk');
|
222
|
+
}
|
223
|
+
if (er) {
|
219
224
|
stream.emit('error', er);
|
220
225
|
processNextTick(cb, er);
|
221
226
|
valid = false;
|
@@ -265,11 +270,12 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
265
270
|
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
266
271
|
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
267
272
|
this._writableState.defaultEncoding = encoding;
|
273
|
+
return this;
|
268
274
|
};
|
269
275
|
|
270
276
|
function decodeChunk(state, chunk, encoding) {
|
271
277
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
272
|
-
chunk =
|
278
|
+
chunk = bufferShim.from(chunk, encoding);
|
273
279
|
}
|
274
280
|
return chunk;
|
275
281
|
}
|
@@ -392,12 +398,16 @@ function clearBuffer(stream, state) {
|
|
392
398
|
|
393
399
|
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
394
400
|
|
395
|
-
// doWrite is always async, defer these to save a bit of time
|
401
|
+
// doWrite is almost always async, defer these to save a bit of time
|
396
402
|
// as the hot path ends with doWrite
|
397
403
|
state.pendingcb++;
|
398
404
|
state.lastBufferedRequest = null;
|
399
|
-
|
400
|
-
|
405
|
+
if (holder.next) {
|
406
|
+
state.corkedRequestsFree = holder.next;
|
407
|
+
holder.next = null;
|
408
|
+
} else {
|
409
|
+
state.corkedRequestsFree = new CorkedRequest(state);
|
410
|
+
}
|
401
411
|
} else {
|
402
412
|
// Slow case, write chunks one-by-one
|
403
413
|
while (entry) {
|
@@ -0,0 +1,64 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var Buffer = require('buffer').Buffer;
|
4
|
+
/*<replacement>*/
|
5
|
+
var bufferShim = require('buffer-shims');
|
6
|
+
/*</replacement>*/
|
7
|
+
|
8
|
+
module.exports = BufferList;
|
9
|
+
|
10
|
+
function BufferList() {
|
11
|
+
this.head = null;
|
12
|
+
this.tail = null;
|
13
|
+
this.length = 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
BufferList.prototype.push = function (v) {
|
17
|
+
var entry = { data: v, next: null };
|
18
|
+
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
19
|
+
this.tail = entry;
|
20
|
+
++this.length;
|
21
|
+
};
|
22
|
+
|
23
|
+
BufferList.prototype.unshift = function (v) {
|
24
|
+
var entry = { data: v, next: this.head };
|
25
|
+
if (this.length === 0) this.tail = entry;
|
26
|
+
this.head = entry;
|
27
|
+
++this.length;
|
28
|
+
};
|
29
|
+
|
30
|
+
BufferList.prototype.shift = function () {
|
31
|
+
if (this.length === 0) return;
|
32
|
+
var ret = this.head.data;
|
33
|
+
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
34
|
+
--this.length;
|
35
|
+
return ret;
|
36
|
+
};
|
37
|
+
|
38
|
+
BufferList.prototype.clear = function () {
|
39
|
+
this.head = this.tail = null;
|
40
|
+
this.length = 0;
|
41
|
+
};
|
42
|
+
|
43
|
+
BufferList.prototype.join = function (s) {
|
44
|
+
if (this.length === 0) return '';
|
45
|
+
var p = this.head;
|
46
|
+
var ret = '' + p.data;
|
47
|
+
while (p = p.next) {
|
48
|
+
ret += s + p.data;
|
49
|
+
}return ret;
|
50
|
+
};
|
51
|
+
|
52
|
+
BufferList.prototype.concat = function (n) {
|
53
|
+
if (this.length === 0) return bufferShim.alloc(0);
|
54
|
+
if (this.length === 1) return this.head.data;
|
55
|
+
var ret = bufferShim.allocUnsafe(n >>> 0);
|
56
|
+
var p = this.head;
|
57
|
+
var i = 0;
|
58
|
+
while (p) {
|
59
|
+
p.data.copy(ret, i);
|
60
|
+
i += p.data.length;
|
61
|
+
p = p.next;
|
62
|
+
}
|
63
|
+
return ret;
|
64
|
+
};
|