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
@@ -1,640 +0,0 @@
|
|
1
|
-
var tape = require('tape')
|
2
|
-
, crypto = require('crypto')
|
3
|
-
, fs = require('fs')
|
4
|
-
, hash = require('hash_file')
|
5
|
-
, BufferList = require('../')
|
6
|
-
|
7
|
-
, encodings =
|
8
|
-
('hex utf8 utf-8 ascii binary base64'
|
9
|
-
+ (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
|
10
|
-
|
11
|
-
tape('single bytes from single buffer', function (t) {
|
12
|
-
var bl = new BufferList()
|
13
|
-
bl.append(new Buffer('abcd'))
|
14
|
-
|
15
|
-
t.equal(bl.length, 4)
|
16
|
-
|
17
|
-
t.equal(bl.get(0), 97)
|
18
|
-
t.equal(bl.get(1), 98)
|
19
|
-
t.equal(bl.get(2), 99)
|
20
|
-
t.equal(bl.get(3), 100)
|
21
|
-
|
22
|
-
t.end()
|
23
|
-
})
|
24
|
-
|
25
|
-
tape('single bytes from multiple buffers', function (t) {
|
26
|
-
var bl = new BufferList()
|
27
|
-
bl.append(new Buffer('abcd'))
|
28
|
-
bl.append(new Buffer('efg'))
|
29
|
-
bl.append(new Buffer('hi'))
|
30
|
-
bl.append(new Buffer('j'))
|
31
|
-
|
32
|
-
t.equal(bl.length, 10)
|
33
|
-
|
34
|
-
t.equal(bl.get(0), 97)
|
35
|
-
t.equal(bl.get(1), 98)
|
36
|
-
t.equal(bl.get(2), 99)
|
37
|
-
t.equal(bl.get(3), 100)
|
38
|
-
t.equal(bl.get(4), 101)
|
39
|
-
t.equal(bl.get(5), 102)
|
40
|
-
t.equal(bl.get(6), 103)
|
41
|
-
t.equal(bl.get(7), 104)
|
42
|
-
t.equal(bl.get(8), 105)
|
43
|
-
t.equal(bl.get(9), 106)
|
44
|
-
t.end()
|
45
|
-
})
|
46
|
-
|
47
|
-
tape('multi bytes from single buffer', function (t) {
|
48
|
-
var bl = new BufferList()
|
49
|
-
bl.append(new Buffer('abcd'))
|
50
|
-
|
51
|
-
t.equal(bl.length, 4)
|
52
|
-
|
53
|
-
t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
|
54
|
-
t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
|
55
|
-
t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
|
56
|
-
|
57
|
-
t.end()
|
58
|
-
})
|
59
|
-
|
60
|
-
tape('multiple bytes from multiple buffers', function (t) {
|
61
|
-
var bl = new BufferList()
|
62
|
-
|
63
|
-
bl.append(new Buffer('abcd'))
|
64
|
-
bl.append(new Buffer('efg'))
|
65
|
-
bl.append(new Buffer('hi'))
|
66
|
-
bl.append(new Buffer('j'))
|
67
|
-
|
68
|
-
t.equal(bl.length, 10)
|
69
|
-
|
70
|
-
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
71
|
-
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
72
|
-
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
73
|
-
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
74
|
-
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
75
|
-
|
76
|
-
t.end()
|
77
|
-
})
|
78
|
-
|
79
|
-
tape('multiple bytes from multiple buffer lists', function (t) {
|
80
|
-
var bl = new BufferList()
|
81
|
-
|
82
|
-
bl.append(new BufferList([ new Buffer('abcd'), new Buffer('efg') ]))
|
83
|
-
bl.append(new BufferList([ new Buffer('hi'), new Buffer('j') ]))
|
84
|
-
|
85
|
-
t.equal(bl.length, 10)
|
86
|
-
|
87
|
-
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
88
|
-
|
89
|
-
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
90
|
-
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
91
|
-
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
92
|
-
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
93
|
-
|
94
|
-
t.end()
|
95
|
-
})
|
96
|
-
|
97
|
-
// same data as previous test, just using nested constructors
|
98
|
-
tape('multiple bytes from crazy nested buffer lists', function (t) {
|
99
|
-
var bl = new BufferList()
|
100
|
-
|
101
|
-
bl.append(new BufferList([
|
102
|
-
new BufferList([
|
103
|
-
new BufferList(new Buffer('abc'))
|
104
|
-
, new Buffer('d')
|
105
|
-
, new BufferList(new Buffer('efg'))
|
106
|
-
])
|
107
|
-
, new BufferList([ new Buffer('hi') ])
|
108
|
-
, new BufferList(new Buffer('j'))
|
109
|
-
]))
|
110
|
-
|
111
|
-
t.equal(bl.length, 10)
|
112
|
-
|
113
|
-
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
114
|
-
|
115
|
-
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
116
|
-
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
117
|
-
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
118
|
-
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
119
|
-
|
120
|
-
t.end()
|
121
|
-
})
|
122
|
-
|
123
|
-
tape('append accepts arrays of Buffers', function (t) {
|
124
|
-
var bl = new BufferList()
|
125
|
-
bl.append(new Buffer('abc'))
|
126
|
-
bl.append([ new Buffer('def') ])
|
127
|
-
bl.append([ new Buffer('ghi'), new Buffer('jkl') ])
|
128
|
-
bl.append([ new Buffer('mnop'), new Buffer('qrstu'), new Buffer('vwxyz') ])
|
129
|
-
t.equal(bl.length, 26)
|
130
|
-
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
131
|
-
t.end()
|
132
|
-
})
|
133
|
-
|
134
|
-
tape('append accepts arrays of BufferLists', function (t) {
|
135
|
-
var bl = new BufferList()
|
136
|
-
bl.append(new Buffer('abc'))
|
137
|
-
bl.append([ new BufferList('def') ])
|
138
|
-
bl.append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ]))
|
139
|
-
bl.append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ])
|
140
|
-
t.equal(bl.length, 26)
|
141
|
-
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
142
|
-
t.end()
|
143
|
-
})
|
144
|
-
|
145
|
-
tape('append chainable', function (t) {
|
146
|
-
var bl = new BufferList()
|
147
|
-
t.ok(bl.append(new Buffer('abcd')) === bl)
|
148
|
-
t.ok(bl.append([ new Buffer('abcd') ]) === bl)
|
149
|
-
t.ok(bl.append(new BufferList(new Buffer('abcd'))) === bl)
|
150
|
-
t.ok(bl.append([ new BufferList(new Buffer('abcd')) ]) === bl)
|
151
|
-
t.end()
|
152
|
-
})
|
153
|
-
|
154
|
-
tape('append chainable (test results)', function (t) {
|
155
|
-
var bl = new BufferList('abc')
|
156
|
-
.append([ new BufferList('def') ])
|
157
|
-
.append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ]))
|
158
|
-
.append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ])
|
159
|
-
|
160
|
-
t.equal(bl.length, 26)
|
161
|
-
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
162
|
-
t.end()
|
163
|
-
})
|
164
|
-
|
165
|
-
tape('consuming from multiple buffers', function (t) {
|
166
|
-
var bl = new BufferList()
|
167
|
-
|
168
|
-
bl.append(new Buffer('abcd'))
|
169
|
-
bl.append(new Buffer('efg'))
|
170
|
-
bl.append(new Buffer('hi'))
|
171
|
-
bl.append(new Buffer('j'))
|
172
|
-
|
173
|
-
t.equal(bl.length, 10)
|
174
|
-
|
175
|
-
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
176
|
-
|
177
|
-
bl.consume(3)
|
178
|
-
t.equal(bl.length, 7)
|
179
|
-
t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
|
180
|
-
|
181
|
-
bl.consume(2)
|
182
|
-
t.equal(bl.length, 5)
|
183
|
-
t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
|
184
|
-
|
185
|
-
bl.consume(1)
|
186
|
-
t.equal(bl.length, 4)
|
187
|
-
t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
|
188
|
-
|
189
|
-
bl.consume(1)
|
190
|
-
t.equal(bl.length, 3)
|
191
|
-
t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
|
192
|
-
|
193
|
-
bl.consume(2)
|
194
|
-
t.equal(bl.length, 1)
|
195
|
-
t.equal(bl.slice(0, 1).toString('ascii'), 'j')
|
196
|
-
|
197
|
-
t.end()
|
198
|
-
})
|
199
|
-
|
200
|
-
tape('complete consumption', function (t) {
|
201
|
-
var bl = new BufferList()
|
202
|
-
|
203
|
-
bl.append(new Buffer('a'))
|
204
|
-
bl.append(new Buffer('b'))
|
205
|
-
|
206
|
-
bl.consume(2)
|
207
|
-
|
208
|
-
t.equal(bl.length, 0)
|
209
|
-
t.equal(bl._bufs.length, 0)
|
210
|
-
|
211
|
-
t.end()
|
212
|
-
})
|
213
|
-
|
214
|
-
tape('test readUInt8 / readInt8', function (t) {
|
215
|
-
var buf1 = new Buffer(1)
|
216
|
-
, buf2 = new Buffer(3)
|
217
|
-
, buf3 = new Buffer(3)
|
218
|
-
, bl = new BufferList()
|
219
|
-
|
220
|
-
buf2[1] = 0x3
|
221
|
-
buf2[2] = 0x4
|
222
|
-
buf3[0] = 0x23
|
223
|
-
buf3[1] = 0x42
|
224
|
-
|
225
|
-
bl.append(buf1)
|
226
|
-
bl.append(buf2)
|
227
|
-
bl.append(buf3)
|
228
|
-
|
229
|
-
t.equal(bl.readUInt8(2), 0x3)
|
230
|
-
t.equal(bl.readInt8(2), 0x3)
|
231
|
-
t.equal(bl.readUInt8(3), 0x4)
|
232
|
-
t.equal(bl.readInt8(3), 0x4)
|
233
|
-
t.equal(bl.readUInt8(4), 0x23)
|
234
|
-
t.equal(bl.readInt8(4), 0x23)
|
235
|
-
t.equal(bl.readUInt8(5), 0x42)
|
236
|
-
t.equal(bl.readInt8(5), 0x42)
|
237
|
-
t.end()
|
238
|
-
})
|
239
|
-
|
240
|
-
tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
|
241
|
-
var buf1 = new Buffer(1)
|
242
|
-
, buf2 = new Buffer(3)
|
243
|
-
, buf3 = new Buffer(3)
|
244
|
-
, bl = new BufferList()
|
245
|
-
|
246
|
-
buf2[1] = 0x3
|
247
|
-
buf2[2] = 0x4
|
248
|
-
buf3[0] = 0x23
|
249
|
-
buf3[1] = 0x42
|
250
|
-
|
251
|
-
bl.append(buf1)
|
252
|
-
bl.append(buf2)
|
253
|
-
bl.append(buf3)
|
254
|
-
|
255
|
-
t.equal(bl.readUInt16BE(2), 0x0304)
|
256
|
-
t.equal(bl.readUInt16LE(2), 0x0403)
|
257
|
-
t.equal(bl.readInt16BE(2), 0x0304)
|
258
|
-
t.equal(bl.readInt16LE(2), 0x0403)
|
259
|
-
t.equal(bl.readUInt16BE(3), 0x0423)
|
260
|
-
t.equal(bl.readUInt16LE(3), 0x2304)
|
261
|
-
t.equal(bl.readInt16BE(3), 0x0423)
|
262
|
-
t.equal(bl.readInt16LE(3), 0x2304)
|
263
|
-
t.equal(bl.readUInt16BE(4), 0x2342)
|
264
|
-
t.equal(bl.readUInt16LE(4), 0x4223)
|
265
|
-
t.equal(bl.readInt16BE(4), 0x2342)
|
266
|
-
t.equal(bl.readInt16LE(4), 0x4223)
|
267
|
-
t.end()
|
268
|
-
})
|
269
|
-
|
270
|
-
tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
|
271
|
-
var buf1 = new Buffer(1)
|
272
|
-
, buf2 = new Buffer(3)
|
273
|
-
, buf3 = new Buffer(3)
|
274
|
-
, bl = new BufferList()
|
275
|
-
|
276
|
-
buf2[1] = 0x3
|
277
|
-
buf2[2] = 0x4
|
278
|
-
buf3[0] = 0x23
|
279
|
-
buf3[1] = 0x42
|
280
|
-
|
281
|
-
bl.append(buf1)
|
282
|
-
bl.append(buf2)
|
283
|
-
bl.append(buf3)
|
284
|
-
|
285
|
-
t.equal(bl.readUInt32BE(2), 0x03042342)
|
286
|
-
t.equal(bl.readUInt32LE(2), 0x42230403)
|
287
|
-
t.equal(bl.readInt32BE(2), 0x03042342)
|
288
|
-
t.equal(bl.readInt32LE(2), 0x42230403)
|
289
|
-
t.end()
|
290
|
-
})
|
291
|
-
|
292
|
-
tape('test readFloatLE / readFloatBE', function (t) {
|
293
|
-
var buf1 = new Buffer(1)
|
294
|
-
, buf2 = new Buffer(3)
|
295
|
-
, buf3 = new Buffer(3)
|
296
|
-
, bl = new BufferList()
|
297
|
-
|
298
|
-
buf2[1] = 0x00
|
299
|
-
buf2[2] = 0x00
|
300
|
-
buf3[0] = 0x80
|
301
|
-
buf3[1] = 0x3f
|
302
|
-
|
303
|
-
bl.append(buf1)
|
304
|
-
bl.append(buf2)
|
305
|
-
bl.append(buf3)
|
306
|
-
|
307
|
-
t.equal(bl.readFloatLE(2), 0x01)
|
308
|
-
t.end()
|
309
|
-
})
|
310
|
-
|
311
|
-
tape('test readDoubleLE / readDoubleBE', function (t) {
|
312
|
-
var buf1 = new Buffer(1)
|
313
|
-
, buf2 = new Buffer(3)
|
314
|
-
, buf3 = new Buffer(10)
|
315
|
-
, bl = new BufferList()
|
316
|
-
|
317
|
-
buf2[1] = 0x55
|
318
|
-
buf2[2] = 0x55
|
319
|
-
buf3[0] = 0x55
|
320
|
-
buf3[1] = 0x55
|
321
|
-
buf3[2] = 0x55
|
322
|
-
buf3[3] = 0x55
|
323
|
-
buf3[4] = 0xd5
|
324
|
-
buf3[5] = 0x3f
|
325
|
-
|
326
|
-
bl.append(buf1)
|
327
|
-
bl.append(buf2)
|
328
|
-
bl.append(buf3)
|
329
|
-
|
330
|
-
t.equal(bl.readDoubleLE(2), 0.3333333333333333)
|
331
|
-
t.end()
|
332
|
-
})
|
333
|
-
|
334
|
-
tape('test toString', function (t) {
|
335
|
-
var bl = new BufferList()
|
336
|
-
|
337
|
-
bl.append(new Buffer('abcd'))
|
338
|
-
bl.append(new Buffer('efg'))
|
339
|
-
bl.append(new Buffer('hi'))
|
340
|
-
bl.append(new Buffer('j'))
|
341
|
-
|
342
|
-
t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
|
343
|
-
t.equal(bl.toString('ascii', 3, 10), 'defghij')
|
344
|
-
t.equal(bl.toString('ascii', 3, 6), 'def')
|
345
|
-
t.equal(bl.toString('ascii', 3, 8), 'defgh')
|
346
|
-
t.equal(bl.toString('ascii', 5, 10), 'fghij')
|
347
|
-
|
348
|
-
t.end()
|
349
|
-
})
|
350
|
-
|
351
|
-
tape('test toString encoding', function (t) {
|
352
|
-
var bl = new BufferList()
|
353
|
-
, b = new Buffer('abcdefghij\xff\x00')
|
354
|
-
|
355
|
-
bl.append(new Buffer('abcd'))
|
356
|
-
bl.append(new Buffer('efg'))
|
357
|
-
bl.append(new Buffer('hi'))
|
358
|
-
bl.append(new Buffer('j'))
|
359
|
-
bl.append(new Buffer('\xff\x00'))
|
360
|
-
|
361
|
-
encodings.forEach(function (enc) {
|
362
|
-
t.equal(bl.toString(enc), b.toString(enc), enc)
|
363
|
-
})
|
364
|
-
|
365
|
-
t.end()
|
366
|
-
})
|
367
|
-
|
368
|
-
!process.browser && tape('test stream', function (t) {
|
369
|
-
var random = crypto.randomBytes(65534)
|
370
|
-
, rndhash = hash(random, 'md5')
|
371
|
-
, md5sum = crypto.createHash('md5')
|
372
|
-
, bl = new BufferList(function (err, buf) {
|
373
|
-
t.ok(Buffer.isBuffer(buf))
|
374
|
-
t.ok(err === null)
|
375
|
-
t.equal(rndhash, hash(bl.slice(), 'md5'))
|
376
|
-
t.equal(rndhash, hash(buf, 'md5'))
|
377
|
-
|
378
|
-
bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
|
379
|
-
.on('close', function () {
|
380
|
-
var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
|
381
|
-
s.on('data', md5sum.update.bind(md5sum))
|
382
|
-
s.on('end', function() {
|
383
|
-
t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
|
384
|
-
t.end()
|
385
|
-
})
|
386
|
-
})
|
387
|
-
|
388
|
-
})
|
389
|
-
|
390
|
-
fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
|
391
|
-
fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
|
392
|
-
})
|
393
|
-
|
394
|
-
tape('instantiation with Buffer', function (t) {
|
395
|
-
var buf = crypto.randomBytes(1024)
|
396
|
-
, buf2 = crypto.randomBytes(1024)
|
397
|
-
, b = BufferList(buf)
|
398
|
-
|
399
|
-
t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
|
400
|
-
b = BufferList([ buf, buf2 ])
|
401
|
-
t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
|
402
|
-
t.end()
|
403
|
-
})
|
404
|
-
|
405
|
-
tape('test String appendage', function (t) {
|
406
|
-
var bl = new BufferList()
|
407
|
-
, b = new Buffer('abcdefghij\xff\x00')
|
408
|
-
|
409
|
-
bl.append('abcd')
|
410
|
-
bl.append('efg')
|
411
|
-
bl.append('hi')
|
412
|
-
bl.append('j')
|
413
|
-
bl.append('\xff\x00')
|
414
|
-
|
415
|
-
encodings.forEach(function (enc) {
|
416
|
-
t.equal(bl.toString(enc), b.toString(enc))
|
417
|
-
})
|
418
|
-
|
419
|
-
t.end()
|
420
|
-
})
|
421
|
-
|
422
|
-
tape('test Number appendage', function (t) {
|
423
|
-
var bl = new BufferList()
|
424
|
-
, b = new Buffer('1234567890')
|
425
|
-
|
426
|
-
bl.append(1234)
|
427
|
-
bl.append(567)
|
428
|
-
bl.append(89)
|
429
|
-
bl.append(0)
|
430
|
-
|
431
|
-
encodings.forEach(function (enc) {
|
432
|
-
t.equal(bl.toString(enc), b.toString(enc))
|
433
|
-
})
|
434
|
-
|
435
|
-
t.end()
|
436
|
-
})
|
437
|
-
|
438
|
-
tape('write nothing, should get empty buffer', function (t) {
|
439
|
-
t.plan(3)
|
440
|
-
BufferList(function (err, data) {
|
441
|
-
t.notOk(err, 'no error')
|
442
|
-
t.ok(Buffer.isBuffer(data), 'got a buffer')
|
443
|
-
t.equal(0, data.length, 'got a zero-length buffer')
|
444
|
-
t.end()
|
445
|
-
}).end()
|
446
|
-
})
|
447
|
-
|
448
|
-
tape('unicode string', function (t) {
|
449
|
-
t.plan(2)
|
450
|
-
var inp1 = '\u2600'
|
451
|
-
, inp2 = '\u2603'
|
452
|
-
, exp = inp1 + ' and ' + inp2
|
453
|
-
, bl = BufferList()
|
454
|
-
bl.write(inp1)
|
455
|
-
bl.write(' and ')
|
456
|
-
bl.write(inp2)
|
457
|
-
t.equal(exp, bl.toString())
|
458
|
-
t.equal(new Buffer(exp).toString('hex'), bl.toString('hex'))
|
459
|
-
})
|
460
|
-
|
461
|
-
tape('should emit finish', function (t) {
|
462
|
-
var source = BufferList()
|
463
|
-
, dest = BufferList()
|
464
|
-
|
465
|
-
source.write('hello')
|
466
|
-
source.pipe(dest)
|
467
|
-
|
468
|
-
dest.on('finish', function () {
|
469
|
-
t.equal(dest.toString('utf8'), 'hello')
|
470
|
-
t.end()
|
471
|
-
})
|
472
|
-
})
|
473
|
-
|
474
|
-
tape('basic copy', function (t) {
|
475
|
-
var buf = crypto.randomBytes(1024)
|
476
|
-
, buf2 = new Buffer(1024)
|
477
|
-
, b = BufferList(buf)
|
478
|
-
|
479
|
-
b.copy(buf2)
|
480
|
-
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
481
|
-
t.end()
|
482
|
-
})
|
483
|
-
|
484
|
-
tape('copy after many appends', function (t) {
|
485
|
-
var buf = crypto.randomBytes(512)
|
486
|
-
, buf2 = new Buffer(1024)
|
487
|
-
, b = BufferList(buf)
|
488
|
-
|
489
|
-
b.append(buf)
|
490
|
-
b.copy(buf2)
|
491
|
-
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
492
|
-
t.end()
|
493
|
-
})
|
494
|
-
|
495
|
-
tape('copy at a precise position', function (t) {
|
496
|
-
var buf = crypto.randomBytes(1004)
|
497
|
-
, buf2 = new Buffer(1024)
|
498
|
-
, b = BufferList(buf)
|
499
|
-
|
500
|
-
b.copy(buf2, 20)
|
501
|
-
t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
|
502
|
-
t.end()
|
503
|
-
})
|
504
|
-
|
505
|
-
tape('copy starting from a precise location', function (t) {
|
506
|
-
var buf = crypto.randomBytes(10)
|
507
|
-
, buf2 = new Buffer(5)
|
508
|
-
, b = BufferList(buf)
|
509
|
-
|
510
|
-
b.copy(buf2, 0, 5)
|
511
|
-
t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
|
512
|
-
t.end()
|
513
|
-
})
|
514
|
-
|
515
|
-
tape('copy in an interval', function (t) {
|
516
|
-
var rnd = crypto.randomBytes(10)
|
517
|
-
, b = BufferList(rnd) // put the random bytes there
|
518
|
-
, actual = new Buffer(3)
|
519
|
-
, expected = new Buffer(3)
|
520
|
-
|
521
|
-
rnd.copy(expected, 0, 5, 8)
|
522
|
-
b.copy(actual, 0, 5, 8)
|
523
|
-
|
524
|
-
t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
|
525
|
-
t.end()
|
526
|
-
})
|
527
|
-
|
528
|
-
tape('copy an interval between two buffers', function (t) {
|
529
|
-
var buf = crypto.randomBytes(10)
|
530
|
-
, buf2 = new Buffer(10)
|
531
|
-
, b = BufferList(buf)
|
532
|
-
|
533
|
-
b.append(buf)
|
534
|
-
b.copy(buf2, 0, 5, 15)
|
535
|
-
|
536
|
-
t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
|
537
|
-
t.end()
|
538
|
-
})
|
539
|
-
|
540
|
-
tape('duplicate', function (t) {
|
541
|
-
t.plan(2)
|
542
|
-
|
543
|
-
var bl = new BufferList('abcdefghij\xff\x00')
|
544
|
-
, dup = bl.duplicate()
|
545
|
-
|
546
|
-
t.equal(bl.prototype, dup.prototype)
|
547
|
-
t.equal(bl.toString('hex'), dup.toString('hex'))
|
548
|
-
})
|
549
|
-
|
550
|
-
tape('destroy no pipe', function (t) {
|
551
|
-
t.plan(2)
|
552
|
-
|
553
|
-
var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
|
554
|
-
bl.destroy()
|
555
|
-
|
556
|
-
t.equal(bl._bufs.length, 0)
|
557
|
-
t.equal(bl.length, 0)
|
558
|
-
})
|
559
|
-
|
560
|
-
!process.browser && tape('destroy with pipe before read end', function (t) {
|
561
|
-
t.plan(2)
|
562
|
-
|
563
|
-
var bl = new BufferList()
|
564
|
-
fs.createReadStream(__dirname + '/test.js')
|
565
|
-
.pipe(bl)
|
566
|
-
|
567
|
-
bl.destroy()
|
568
|
-
|
569
|
-
t.equal(bl._bufs.length, 0)
|
570
|
-
t.equal(bl.length, 0)
|
571
|
-
|
572
|
-
})
|
573
|
-
|
574
|
-
!process.browser && tape('destroy with pipe before read end with race', function (t) {
|
575
|
-
t.plan(2)
|
576
|
-
|
577
|
-
var bl = new BufferList()
|
578
|
-
fs.createReadStream(__dirname + '/test.js')
|
579
|
-
.pipe(bl)
|
580
|
-
|
581
|
-
setTimeout(function () {
|
582
|
-
bl.destroy()
|
583
|
-
setTimeout(function () {
|
584
|
-
t.equal(bl._bufs.length, 0)
|
585
|
-
t.equal(bl.length, 0)
|
586
|
-
}, 500)
|
587
|
-
}, 500)
|
588
|
-
})
|
589
|
-
|
590
|
-
!process.browser && tape('destroy with pipe after read end', function (t) {
|
591
|
-
t.plan(2)
|
592
|
-
|
593
|
-
var bl = new BufferList()
|
594
|
-
fs.createReadStream(__dirname + '/test.js')
|
595
|
-
.on('end', onEnd)
|
596
|
-
.pipe(bl)
|
597
|
-
|
598
|
-
function onEnd () {
|
599
|
-
bl.destroy()
|
600
|
-
|
601
|
-
t.equal(bl._bufs.length, 0)
|
602
|
-
t.equal(bl.length, 0)
|
603
|
-
}
|
604
|
-
})
|
605
|
-
|
606
|
-
!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
|
607
|
-
t.plan(4)
|
608
|
-
|
609
|
-
var bl = new BufferList()
|
610
|
-
, ds = new BufferList()
|
611
|
-
|
612
|
-
fs.createReadStream(__dirname + '/test.js')
|
613
|
-
.on('end', onEnd)
|
614
|
-
.pipe(bl)
|
615
|
-
|
616
|
-
function onEnd () {
|
617
|
-
bl.pipe(ds)
|
618
|
-
|
619
|
-
setTimeout(function () {
|
620
|
-
bl.destroy()
|
621
|
-
|
622
|
-
t.equals(bl._bufs.length, 0)
|
623
|
-
t.equals(bl.length, 0)
|
624
|
-
|
625
|
-
ds.destroy()
|
626
|
-
|
627
|
-
t.equals(bl._bufs.length, 0)
|
628
|
-
t.equals(bl.length, 0)
|
629
|
-
|
630
|
-
}, 100)
|
631
|
-
}
|
632
|
-
})
|
633
|
-
|
634
|
-
!process.browser && tape('handle error', function (t) {
|
635
|
-
t.plan(2)
|
636
|
-
fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
|
637
|
-
t.ok(err instanceof Error, 'has error')
|
638
|
-
t.notOk(data, 'no data')
|
639
|
-
}))
|
640
|
-
})
|
@@ -1 +0,0 @@
|
|
1
|
-
node_modules/*
|