@contrast/agent 4.32.11 → 4.32.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/config/util.js +2 -1
- package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
- package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
- package/node_modules/file-stream-rotator/README.md +16 -1
- package/node_modules/file-stream-rotator/package.json +5 -5
- package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
- package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
- package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
- package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
- package/node_modules/object-hash/dist/object_hash.js +1 -2
- package/node_modules/object-hash/index.js +33 -21
- package/node_modules/object-hash/package.json +20 -18
- package/node_modules/object-hash/readme.markdown +20 -5
- package/node_modules/winston-daily-rotate-file/README.md +81 -12
- package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
- package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
- package/node_modules/winston-daily-rotate-file/package.json +20 -19
- package/node_modules/winston-transport/.eslintrc +1 -1
- package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
- package/node_modules/winston-transport/CHANGELOG.md +11 -0
- package/node_modules/winston-transport/dist/index.js +2 -2
- package/node_modules/winston-transport/index.d.ts +2 -0
- package/node_modules/winston-transport/index.js +2 -2
- package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
- package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
- package/node_modules/winston-transport/package.json +16 -14
- package/package.json +7 -7
- package/node_modules/colors/LICENSE +0 -25
- package/node_modules/colors/README.md +0 -221
- package/node_modules/colors/examples/normal-usage.js +0 -82
- package/node_modules/colors/examples/safe-string.js +0 -79
- package/node_modules/colors/index.d.ts +0 -136
- package/node_modules/colors/lib/colors.js +0 -211
- package/node_modules/colors/lib/custom/trap.js +0 -46
- package/node_modules/colors/lib/custom/zalgo.js +0 -110
- package/node_modules/colors/lib/extendStringPrototype.js +0 -110
- package/node_modules/colors/lib/index.js +0 -13
- package/node_modules/colors/lib/maps/america.js +0 -10
- package/node_modules/colors/lib/maps/rainbow.js +0 -12
- package/node_modules/colors/lib/maps/random.js +0 -11
- package/node_modules/colors/lib/maps/zebra.js +0 -5
- package/node_modules/colors/lib/styles.js +0 -95
- package/node_modules/colors/lib/system/has-flag.js +0 -35
- package/node_modules/colors/lib/system/supports-colors.js +0 -151
- package/node_modules/colors/package.json +0 -49
- package/node_modules/colors/safe.d.ts +0 -48
- package/node_modules/colors/safe.js +0 -10
- package/node_modules/colors/themes/generic-logging.js +0 -12
- package/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/core-util-is/README.md +0 -3
- package/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/core-util-is/package.json +0 -36
- package/node_modules/core-util-is/test.js +0 -68
- package/node_modules/cycle/README.md +0 -49
- package/node_modules/cycle/cycle.js +0 -170
- package/node_modules/cycle/package.json +0 -16
- package/node_modules/fast-safe-stringify/.travis.yml +0 -8
- package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
- package/node_modules/fast-safe-stringify/LICENSE +0 -23
- package/node_modules/fast-safe-stringify/benchmark.js +0 -137
- package/node_modules/fast-safe-stringify/index.d.ts +0 -8
- package/node_modules/fast-safe-stringify/index.js +0 -161
- package/node_modules/fast-safe-stringify/package.json +0 -50
- package/node_modules/fast-safe-stringify/readme.md +0 -154
- package/node_modules/fast-safe-stringify/test-stable.js +0 -311
- package/node_modules/fast-safe-stringify/test.js +0 -304
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -49
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/object-hash/.jshintrc +0 -19
- package/node_modules/object-hash/.travis.yml +0 -35
- package/node_modules/object-hash/bower.json +0 -15
- package/node_modules/object-hash/dist/object_hash.js.map +0 -1
- package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
- package/node_modules/object-hash/gulpfile.js +0 -97
- package/node_modules/object-hash/karma.conf.js +0 -69
- package/node_modules/object-hash/test/blob.js +0 -41
- package/node_modules/object-hash/test/index.js +0 -290
- package/node_modules/object-hash/test/object-classes.js +0 -106
- package/node_modules/object-hash/test/old-crypto.js +0 -60
- package/node_modules/object-hash/test/replacer.js +0 -36
- package/node_modules/object-hash/test/types.js +0 -174
- package/node_modules/object-hash/test/writeToStream.js +0 -27
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -29
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- package/node_modules/readable-stream/package.json +0 -56
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/winston-compat/.gitattributes +0 -1
- package/node_modules/winston-compat/.node-version +0 -1
- package/node_modules/winston-compat/CHANGELOG.md +0 -17
- package/node_modules/winston-compat/LICENSE +0 -22
- package/node_modules/winston-compat/README.md +0 -2
- package/node_modules/winston-compat/index.js +0 -295
- package/node_modules/winston-compat/lib/transport.js +0 -135
- package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
- package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
- package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
- package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
- package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
- package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
- package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
- package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
- package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
- package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
- package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
- package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
- package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
- package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
- package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
- package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
- package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
- package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
- package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
- package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
- package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
- package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
- package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
- package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
- package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
- package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
- package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
- package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
- package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
- package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
- package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
- package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
- package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
- package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
- package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
- package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
- package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
- package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
- package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
- package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
- package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
- package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
- package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
- package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
- package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
- package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
- package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
- package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
- package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
- package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
- package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
- package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
- package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
- package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
- package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
- package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
- package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
- package/node_modules/winston-compat/package.json +0 -46
- package/node_modules/winston-compat/test/clone.test.js +0 -25
- package/node_modules/winston-compat/test/helpers.js +0 -256
- package/node_modules/winston-compat/test/timestamp.test.js +0 -14
- package/node_modules/winston-compat/test/transports/transport.js +0 -205
- package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
- package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
- package/node_modules/winston-daily-rotate-file/.node-version +0 -1
- package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
- package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
- package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
- package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
- package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
- package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
- package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
- package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
- package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
- package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
- package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
- package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
- package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
- package/node_modules/winston-transport/.travis.yml +0 -17
- package/node_modules/winston-transport/tsconfig.json +0 -22
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
|
@@ -25,11 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
'use strict';
|
|
27
27
|
|
|
28
|
-
/*<replacement>*/
|
|
29
|
-
|
|
30
|
-
var pna = require('process-nextick-args');
|
|
31
|
-
/*</replacement>*/
|
|
32
|
-
|
|
33
28
|
module.exports = Writable;
|
|
34
29
|
|
|
35
30
|
/* <replacement> */
|
|
@@ -44,7 +39,6 @@ function WriteReq(chunk, encoding, cb) {
|
|
|
44
39
|
// there will be only 2 of these for each stream
|
|
45
40
|
function CorkedRequest(state) {
|
|
46
41
|
var _this = this;
|
|
47
|
-
|
|
48
42
|
this.next = null;
|
|
49
43
|
this.entry = null;
|
|
50
44
|
this.finish = function () {
|
|
@@ -53,21 +47,12 @@ function CorkedRequest(state) {
|
|
|
53
47
|
}
|
|
54
48
|
/* </replacement> */
|
|
55
49
|
|
|
56
|
-
/*<replacement>*/
|
|
57
|
-
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
|
|
58
|
-
/*</replacement>*/
|
|
59
|
-
|
|
60
50
|
/*<replacement>*/
|
|
61
51
|
var Duplex;
|
|
62
52
|
/*</replacement>*/
|
|
63
53
|
|
|
64
54
|
Writable.WritableState = WritableState;
|
|
65
55
|
|
|
66
|
-
/*<replacement>*/
|
|
67
|
-
var util = Object.create(require('core-util-is'));
|
|
68
|
-
util.inherits = require('inherits');
|
|
69
|
-
/*</replacement>*/
|
|
70
|
-
|
|
71
56
|
/*<replacement>*/
|
|
72
57
|
var internalUtil = {
|
|
73
58
|
deprecate: require('util-deprecate')
|
|
@@ -78,54 +63,49 @@ var internalUtil = {
|
|
|
78
63
|
var Stream = require('./internal/streams/stream');
|
|
79
64
|
/*</replacement>*/
|
|
80
65
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var Buffer = require('safe-buffer').Buffer;
|
|
84
|
-
var OurUint8Array = global.Uint8Array || function () {};
|
|
66
|
+
var Buffer = require('buffer').Buffer;
|
|
67
|
+
var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
|
|
85
68
|
function _uint8ArrayToBuffer(chunk) {
|
|
86
69
|
return Buffer.from(chunk);
|
|
87
70
|
}
|
|
88
71
|
function _isUint8Array(obj) {
|
|
89
72
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
90
73
|
}
|
|
91
|
-
|
|
92
|
-
/*</replacement>*/
|
|
93
|
-
|
|
94
74
|
var destroyImpl = require('./internal/streams/destroy');
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
75
|
+
var _require = require('./internal/streams/state'),
|
|
76
|
+
getHighWaterMark = _require.getHighWaterMark;
|
|
77
|
+
var _require$codes = require('../errors').codes,
|
|
78
|
+
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
|
|
79
|
+
ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
|
|
80
|
+
ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
|
|
81
|
+
ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
|
|
82
|
+
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
|
|
83
|
+
ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
|
|
84
|
+
ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
|
|
85
|
+
ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
|
86
|
+
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
87
|
+
require('inherits')(Writable, Stream);
|
|
98
88
|
function nop() {}
|
|
99
|
-
|
|
100
|
-
function WritableState(options, stream) {
|
|
89
|
+
function WritableState(options, stream, isDuplex) {
|
|
101
90
|
Duplex = Duplex || require('./_stream_duplex');
|
|
102
|
-
|
|
103
91
|
options = options || {};
|
|
104
92
|
|
|
105
93
|
// Duplex streams are both readable and writable, but share
|
|
106
94
|
// the same options object.
|
|
107
95
|
// However, some cases require setting options to different
|
|
108
|
-
// values for the readable and the writable sides of the duplex stream
|
|
109
|
-
//
|
|
110
|
-
|
|
96
|
+
// values for the readable and the writable sides of the duplex stream,
|
|
97
|
+
// e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
|
|
98
|
+
if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
|
|
111
99
|
|
|
112
100
|
// object stream flag to indicate whether or not this stream
|
|
113
101
|
// contains buffers or objects.
|
|
114
102
|
this.objectMode = !!options.objectMode;
|
|
115
|
-
|
|
116
103
|
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
|
117
104
|
|
|
118
105
|
// the point at which write() starts returning false
|
|
119
106
|
// Note: 0 is a valid value, means that we always return false if
|
|
120
107
|
// the entire buffer is not flushed immediately on write()
|
|
121
|
-
|
|
122
|
-
var writableHwm = options.writableHighWaterMark;
|
|
123
|
-
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
|
124
|
-
|
|
125
|
-
if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
|
|
126
|
-
|
|
127
|
-
// cast to ints.
|
|
128
|
-
this.highWaterMark = Math.floor(this.highWaterMark);
|
|
108
|
+
this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
|
|
129
109
|
|
|
130
110
|
// if _final has been called
|
|
131
111
|
this.finalCalled = false;
|
|
@@ -185,7 +165,6 @@ function WritableState(options, stream) {
|
|
|
185
165
|
|
|
186
166
|
// the amount that is being written when _write is called.
|
|
187
167
|
this.writelen = 0;
|
|
188
|
-
|
|
189
168
|
this.bufferedRequest = null;
|
|
190
169
|
this.lastBufferedRequest = null;
|
|
191
170
|
|
|
@@ -200,6 +179,12 @@ function WritableState(options, stream) {
|
|
|
200
179
|
// True if the error was already emitted and should not be thrown again
|
|
201
180
|
this.errorEmitted = false;
|
|
202
181
|
|
|
182
|
+
// Should close be emitted on destroy. Defaults to true.
|
|
183
|
+
this.emitClose = options.emitClose !== false;
|
|
184
|
+
|
|
185
|
+
// Should .destroy() be called after 'finish' (and potentially 'end')
|
|
186
|
+
this.autoDestroy = !!options.autoDestroy;
|
|
187
|
+
|
|
203
188
|
// count buffered requests
|
|
204
189
|
this.bufferedRequestCount = 0;
|
|
205
190
|
|
|
@@ -207,7 +192,6 @@ function WritableState(options, stream) {
|
|
|
207
192
|
// one allocated and free to use, and we maintain at most two
|
|
208
193
|
this.corkedRequestsFree = new CorkedRequest(this);
|
|
209
194
|
}
|
|
210
|
-
|
|
211
195
|
WritableState.prototype.getBuffer = function getBuffer() {
|
|
212
196
|
var current = this.bufferedRequest;
|
|
213
197
|
var out = [];
|
|
@@ -217,11 +201,10 @@ WritableState.prototype.getBuffer = function getBuffer() {
|
|
|
217
201
|
}
|
|
218
202
|
return out;
|
|
219
203
|
};
|
|
220
|
-
|
|
221
204
|
(function () {
|
|
222
205
|
try {
|
|
223
206
|
Object.defineProperty(WritableState.prototype, 'buffer', {
|
|
224
|
-
get: internalUtil.deprecate(function () {
|
|
207
|
+
get: internalUtil.deprecate(function writableStateBufferGetter() {
|
|
225
208
|
return this.getBuffer();
|
|
226
209
|
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
|
|
227
210
|
});
|
|
@@ -234,19 +217,17 @@ var realHasInstance;
|
|
|
234
217
|
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
|
|
235
218
|
realHasInstance = Function.prototype[Symbol.hasInstance];
|
|
236
219
|
Object.defineProperty(Writable, Symbol.hasInstance, {
|
|
237
|
-
value: function (object) {
|
|
220
|
+
value: function value(object) {
|
|
238
221
|
if (realHasInstance.call(this, object)) return true;
|
|
239
222
|
if (this !== Writable) return false;
|
|
240
|
-
|
|
241
223
|
return object && object._writableState instanceof WritableState;
|
|
242
224
|
}
|
|
243
225
|
});
|
|
244
226
|
} else {
|
|
245
|
-
realHasInstance = function (object) {
|
|
227
|
+
realHasInstance = function realHasInstance(object) {
|
|
246
228
|
return object instanceof this;
|
|
247
229
|
};
|
|
248
230
|
}
|
|
249
|
-
|
|
250
231
|
function Writable(options) {
|
|
251
232
|
Duplex = Duplex || require('./_stream_duplex');
|
|
252
233
|
|
|
@@ -257,123 +238,109 @@ function Writable(options) {
|
|
|
257
238
|
// Trying to use the custom `instanceof` for Writable here will also break the
|
|
258
239
|
// Node.js LazyTransform implementation, which has a non-trivial getter for
|
|
259
240
|
// `_writableState` that would lead to infinite recursion.
|
|
260
|
-
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
|
|
261
|
-
return new Writable(options);
|
|
262
|
-
}
|
|
263
241
|
|
|
264
|
-
|
|
242
|
+
// Checking for a Stream.Duplex instance is faster here instead of inside
|
|
243
|
+
// the WritableState constructor, at least with V8 6.5
|
|
244
|
+
var isDuplex = this instanceof Duplex;
|
|
245
|
+
if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
|
|
246
|
+
this._writableState = new WritableState(options, this, isDuplex);
|
|
265
247
|
|
|
266
248
|
// legacy.
|
|
267
249
|
this.writable = true;
|
|
268
|
-
|
|
269
250
|
if (options) {
|
|
270
251
|
if (typeof options.write === 'function') this._write = options.write;
|
|
271
|
-
|
|
272
252
|
if (typeof options.writev === 'function') this._writev = options.writev;
|
|
273
|
-
|
|
274
253
|
if (typeof options.destroy === 'function') this._destroy = options.destroy;
|
|
275
|
-
|
|
276
254
|
if (typeof options.final === 'function') this._final = options.final;
|
|
277
255
|
}
|
|
278
|
-
|
|
279
256
|
Stream.call(this);
|
|
280
257
|
}
|
|
281
258
|
|
|
282
259
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
|
283
260
|
Writable.prototype.pipe = function () {
|
|
284
|
-
this
|
|
261
|
+
errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
|
|
285
262
|
};
|
|
286
|
-
|
|
287
263
|
function writeAfterEnd(stream, cb) {
|
|
288
|
-
var er = new
|
|
264
|
+
var er = new ERR_STREAM_WRITE_AFTER_END();
|
|
289
265
|
// TODO: defer error events consistently everywhere, not just the cb
|
|
290
|
-
stream
|
|
291
|
-
|
|
266
|
+
errorOrDestroy(stream, er);
|
|
267
|
+
process.nextTick(cb, er);
|
|
292
268
|
}
|
|
293
269
|
|
|
294
270
|
// Checks that a user-supplied chunk is valid, especially for the particular
|
|
295
271
|
// mode the stream is in. Currently this means that `null` is never accepted
|
|
296
272
|
// and undefined/non-string values are only allowed in object mode.
|
|
297
273
|
function validChunk(stream, state, chunk, cb) {
|
|
298
|
-
var
|
|
299
|
-
var er = false;
|
|
300
|
-
|
|
274
|
+
var er;
|
|
301
275
|
if (chunk === null) {
|
|
302
|
-
er = new
|
|
303
|
-
} else if (typeof chunk !== 'string' &&
|
|
304
|
-
er = new
|
|
276
|
+
er = new ERR_STREAM_NULL_VALUES();
|
|
277
|
+
} else if (typeof chunk !== 'string' && !state.objectMode) {
|
|
278
|
+
er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
|
|
305
279
|
}
|
|
306
280
|
if (er) {
|
|
307
|
-
stream
|
|
308
|
-
|
|
309
|
-
|
|
281
|
+
errorOrDestroy(stream, er);
|
|
282
|
+
process.nextTick(cb, er);
|
|
283
|
+
return false;
|
|
310
284
|
}
|
|
311
|
-
return
|
|
285
|
+
return true;
|
|
312
286
|
}
|
|
313
|
-
|
|
314
287
|
Writable.prototype.write = function (chunk, encoding, cb) {
|
|
315
288
|
var state = this._writableState;
|
|
316
289
|
var ret = false;
|
|
317
290
|
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
318
|
-
|
|
319
291
|
if (isBuf && !Buffer.isBuffer(chunk)) {
|
|
320
292
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
321
293
|
}
|
|
322
|
-
|
|
323
294
|
if (typeof encoding === 'function') {
|
|
324
295
|
cb = encoding;
|
|
325
296
|
encoding = null;
|
|
326
297
|
}
|
|
327
|
-
|
|
328
298
|
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
|
329
|
-
|
|
330
299
|
if (typeof cb !== 'function') cb = nop;
|
|
331
|
-
|
|
332
|
-
if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
|
300
|
+
if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
|
|
333
301
|
state.pendingcb++;
|
|
334
302
|
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
|
|
335
303
|
}
|
|
336
|
-
|
|
337
304
|
return ret;
|
|
338
305
|
};
|
|
339
|
-
|
|
340
306
|
Writable.prototype.cork = function () {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
state.corked++;
|
|
307
|
+
this._writableState.corked++;
|
|
344
308
|
};
|
|
345
|
-
|
|
346
309
|
Writable.prototype.uncork = function () {
|
|
347
310
|
var state = this._writableState;
|
|
348
|
-
|
|
349
311
|
if (state.corked) {
|
|
350
312
|
state.corked--;
|
|
351
|
-
|
|
352
|
-
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
313
|
+
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
353
314
|
}
|
|
354
315
|
};
|
|
355
|
-
|
|
356
316
|
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|
357
317
|
// node::ParseEncoding() requires lower case.
|
|
358
318
|
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
|
359
|
-
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new
|
|
319
|
+
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
|
|
360
320
|
this._writableState.defaultEncoding = encoding;
|
|
361
321
|
return this;
|
|
362
322
|
};
|
|
363
|
-
|
|
323
|
+
Object.defineProperty(Writable.prototype, 'writableBuffer', {
|
|
324
|
+
// making it explicit this property is not enumerable
|
|
325
|
+
// because otherwise some prototype manipulation in
|
|
326
|
+
// userland will fail
|
|
327
|
+
enumerable: false,
|
|
328
|
+
get: function get() {
|
|
329
|
+
return this._writableState && this._writableState.getBuffer();
|
|
330
|
+
}
|
|
331
|
+
});
|
|
364
332
|
function decodeChunk(state, chunk, encoding) {
|
|
365
333
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
|
366
334
|
chunk = Buffer.from(chunk, encoding);
|
|
367
335
|
}
|
|
368
336
|
return chunk;
|
|
369
337
|
}
|
|
370
|
-
|
|
371
338
|
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
|
|
372
339
|
// making it explicit this property is not enumerable
|
|
373
340
|
// because otherwise some prototype manipulation in
|
|
374
341
|
// userland will fail
|
|
375
342
|
enumerable: false,
|
|
376
|
-
get: function () {
|
|
343
|
+
get: function get() {
|
|
377
344
|
return this._writableState.highWaterMark;
|
|
378
345
|
}
|
|
379
346
|
});
|
|
@@ -391,13 +358,10 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
|
|
391
358
|
}
|
|
392
359
|
}
|
|
393
360
|
var len = state.objectMode ? 1 : chunk.length;
|
|
394
|
-
|
|
395
361
|
state.length += len;
|
|
396
|
-
|
|
397
362
|
var ret = state.length < state.highWaterMark;
|
|
398
363
|
// we must ensure that previous needDrain will not be reset to false.
|
|
399
364
|
if (!ret) state.needDrain = true;
|
|
400
|
-
|
|
401
365
|
if (state.writing || state.corked) {
|
|
402
366
|
var last = state.lastBufferedRequest;
|
|
403
367
|
state.lastBufferedRequest = {
|
|
@@ -416,75 +380,63 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
|
|
|
416
380
|
} else {
|
|
417
381
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
418
382
|
}
|
|
419
|
-
|
|
420
383
|
return ret;
|
|
421
384
|
}
|
|
422
|
-
|
|
423
385
|
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
|
424
386
|
state.writelen = len;
|
|
425
387
|
state.writecb = cb;
|
|
426
388
|
state.writing = true;
|
|
427
389
|
state.sync = true;
|
|
428
|
-
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
|
390
|
+
if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
|
429
391
|
state.sync = false;
|
|
430
392
|
}
|
|
431
|
-
|
|
432
393
|
function onwriteError(stream, state, sync, er, cb) {
|
|
433
394
|
--state.pendingcb;
|
|
434
|
-
|
|
435
395
|
if (sync) {
|
|
436
396
|
// defer the callback if we are being called synchronously
|
|
437
397
|
// to avoid piling up things on the stack
|
|
438
|
-
|
|
398
|
+
process.nextTick(cb, er);
|
|
439
399
|
// this can emit finish, and it will always happen
|
|
440
400
|
// after error
|
|
441
|
-
|
|
401
|
+
process.nextTick(finishMaybe, stream, state);
|
|
442
402
|
stream._writableState.errorEmitted = true;
|
|
443
|
-
stream
|
|
403
|
+
errorOrDestroy(stream, er);
|
|
444
404
|
} else {
|
|
445
405
|
// the caller expect this to happen before if
|
|
446
406
|
// it is async
|
|
447
407
|
cb(er);
|
|
448
408
|
stream._writableState.errorEmitted = true;
|
|
449
|
-
stream
|
|
409
|
+
errorOrDestroy(stream, er);
|
|
450
410
|
// this can emit finish, but finish must
|
|
451
411
|
// always follow error
|
|
452
412
|
finishMaybe(stream, state);
|
|
453
413
|
}
|
|
454
414
|
}
|
|
455
|
-
|
|
456
415
|
function onwriteStateUpdate(state) {
|
|
457
416
|
state.writing = false;
|
|
458
417
|
state.writecb = null;
|
|
459
418
|
state.length -= state.writelen;
|
|
460
419
|
state.writelen = 0;
|
|
461
420
|
}
|
|
462
|
-
|
|
463
421
|
function onwrite(stream, er) {
|
|
464
422
|
var state = stream._writableState;
|
|
465
423
|
var sync = state.sync;
|
|
466
424
|
var cb = state.writecb;
|
|
467
|
-
|
|
425
|
+
if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
|
|
468
426
|
onwriteStateUpdate(state);
|
|
469
|
-
|
|
470
427
|
if (er) onwriteError(stream, state, sync, er, cb);else {
|
|
471
428
|
// Check if we're actually ready to finish, but don't emit yet
|
|
472
|
-
var finished = needFinish(state);
|
|
473
|
-
|
|
429
|
+
var finished = needFinish(state) || stream.destroyed;
|
|
474
430
|
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
|
475
431
|
clearBuffer(stream, state);
|
|
476
432
|
}
|
|
477
|
-
|
|
478
433
|
if (sync) {
|
|
479
|
-
|
|
480
|
-
asyncWrite(afterWrite, stream, state, finished, cb);
|
|
481
|
-
/*</replacement>*/
|
|
434
|
+
process.nextTick(afterWrite, stream, state, finished, cb);
|
|
482
435
|
} else {
|
|
483
436
|
afterWrite(stream, state, finished, cb);
|
|
484
437
|
}
|
|
485
438
|
}
|
|
486
439
|
}
|
|
487
|
-
|
|
488
440
|
function afterWrite(stream, state, finished, cb) {
|
|
489
441
|
if (!finished) onwriteDrain(stream, state);
|
|
490
442
|
state.pendingcb--;
|
|
@@ -506,14 +458,12 @@ function onwriteDrain(stream, state) {
|
|
|
506
458
|
function clearBuffer(stream, state) {
|
|
507
459
|
state.bufferProcessing = true;
|
|
508
460
|
var entry = state.bufferedRequest;
|
|
509
|
-
|
|
510
461
|
if (stream._writev && entry && entry.next) {
|
|
511
462
|
// Fast case, write everything using _writev()
|
|
512
463
|
var l = state.bufferedRequestCount;
|
|
513
464
|
var buffer = new Array(l);
|
|
514
465
|
var holder = state.corkedRequestsFree;
|
|
515
466
|
holder.entry = entry;
|
|
516
|
-
|
|
517
467
|
var count = 0;
|
|
518
468
|
var allBuffers = true;
|
|
519
469
|
while (entry) {
|
|
@@ -523,7 +473,6 @@ function clearBuffer(stream, state) {
|
|
|
523
473
|
count += 1;
|
|
524
474
|
}
|
|
525
475
|
buffer.allBuffers = allBuffers;
|
|
526
|
-
|
|
527
476
|
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
|
528
477
|
|
|
529
478
|
// doWrite is almost always async, defer these to save a bit of time
|
|
@@ -544,7 +493,6 @@ function clearBuffer(stream, state) {
|
|
|
544
493
|
var encoding = entry.encoding;
|
|
545
494
|
var cb = entry.callback;
|
|
546
495
|
var len = state.objectMode ? 1 : chunk.length;
|
|
547
|
-
|
|
548
496
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
|
549
497
|
entry = entry.next;
|
|
550
498
|
state.bufferedRequestCount--;
|
|
@@ -556,23 +504,17 @@ function clearBuffer(stream, state) {
|
|
|
556
504
|
break;
|
|
557
505
|
}
|
|
558
506
|
}
|
|
559
|
-
|
|
560
507
|
if (entry === null) state.lastBufferedRequest = null;
|
|
561
508
|
}
|
|
562
|
-
|
|
563
509
|
state.bufferedRequest = entry;
|
|
564
510
|
state.bufferProcessing = false;
|
|
565
511
|
}
|
|
566
|
-
|
|
567
512
|
Writable.prototype._write = function (chunk, encoding, cb) {
|
|
568
|
-
cb(new
|
|
513
|
+
cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
|
|
569
514
|
};
|
|
570
|
-
|
|
571
515
|
Writable.prototype._writev = null;
|
|
572
|
-
|
|
573
516
|
Writable.prototype.end = function (chunk, encoding, cb) {
|
|
574
517
|
var state = this._writableState;
|
|
575
|
-
|
|
576
518
|
if (typeof chunk === 'function') {
|
|
577
519
|
cb = chunk;
|
|
578
520
|
chunk = null;
|
|
@@ -581,7 +523,6 @@ Writable.prototype.end = function (chunk, encoding, cb) {
|
|
|
581
523
|
cb = encoding;
|
|
582
524
|
encoding = null;
|
|
583
525
|
}
|
|
584
|
-
|
|
585
526
|
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
|
586
527
|
|
|
587
528
|
// .end() fully uncorks
|
|
@@ -591,9 +532,18 @@ Writable.prototype.end = function (chunk, encoding, cb) {
|
|
|
591
532
|
}
|
|
592
533
|
|
|
593
534
|
// ignore unnecessary end() calls.
|
|
594
|
-
if (!state.ending
|
|
535
|
+
if (!state.ending) endWritable(this, state, cb);
|
|
536
|
+
return this;
|
|
595
537
|
};
|
|
596
|
-
|
|
538
|
+
Object.defineProperty(Writable.prototype, 'writableLength', {
|
|
539
|
+
// making it explicit this property is not enumerable
|
|
540
|
+
// because otherwise some prototype manipulation in
|
|
541
|
+
// userland will fail
|
|
542
|
+
enumerable: false,
|
|
543
|
+
get: function get() {
|
|
544
|
+
return this._writableState.length;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
597
547
|
function needFinish(state) {
|
|
598
548
|
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
|
599
549
|
}
|
|
@@ -601,7 +551,7 @@ function callFinal(stream, state) {
|
|
|
601
551
|
stream._final(function (err) {
|
|
602
552
|
state.pendingcb--;
|
|
603
553
|
if (err) {
|
|
604
|
-
stream
|
|
554
|
+
errorOrDestroy(stream, err);
|
|
605
555
|
}
|
|
606
556
|
state.prefinished = true;
|
|
607
557
|
stream.emit('prefinish');
|
|
@@ -610,17 +560,16 @@ function callFinal(stream, state) {
|
|
|
610
560
|
}
|
|
611
561
|
function prefinish(stream, state) {
|
|
612
562
|
if (!state.prefinished && !state.finalCalled) {
|
|
613
|
-
if (typeof stream._final === 'function') {
|
|
563
|
+
if (typeof stream._final === 'function' && !state.destroyed) {
|
|
614
564
|
state.pendingcb++;
|
|
615
565
|
state.finalCalled = true;
|
|
616
|
-
|
|
566
|
+
process.nextTick(callFinal, stream, state);
|
|
617
567
|
} else {
|
|
618
568
|
state.prefinished = true;
|
|
619
569
|
stream.emit('prefinish');
|
|
620
570
|
}
|
|
621
571
|
}
|
|
622
572
|
}
|
|
623
|
-
|
|
624
573
|
function finishMaybe(stream, state) {
|
|
625
574
|
var need = needFinish(state);
|
|
626
575
|
if (need) {
|
|
@@ -628,21 +577,27 @@ function finishMaybe(stream, state) {
|
|
|
628
577
|
if (state.pendingcb === 0) {
|
|
629
578
|
state.finished = true;
|
|
630
579
|
stream.emit('finish');
|
|
580
|
+
if (state.autoDestroy) {
|
|
581
|
+
// In case of duplex streams we need a way to detect
|
|
582
|
+
// if the readable side is ready for autoDestroy as well
|
|
583
|
+
var rState = stream._readableState;
|
|
584
|
+
if (!rState || rState.autoDestroy && rState.endEmitted) {
|
|
585
|
+
stream.destroy();
|
|
586
|
+
}
|
|
587
|
+
}
|
|
631
588
|
}
|
|
632
589
|
}
|
|
633
590
|
return need;
|
|
634
591
|
}
|
|
635
|
-
|
|
636
592
|
function endWritable(stream, state, cb) {
|
|
637
593
|
state.ending = true;
|
|
638
594
|
finishMaybe(stream, state);
|
|
639
595
|
if (cb) {
|
|
640
|
-
if (state.finished)
|
|
596
|
+
if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
|
|
641
597
|
}
|
|
642
598
|
state.ended = true;
|
|
643
599
|
stream.writable = false;
|
|
644
600
|
}
|
|
645
|
-
|
|
646
601
|
function onCorkedFinish(corkReq, state, err) {
|
|
647
602
|
var entry = corkReq.entry;
|
|
648
603
|
corkReq.entry = null;
|
|
@@ -652,21 +607,22 @@ function onCorkedFinish(corkReq, state, err) {
|
|
|
652
607
|
cb(err);
|
|
653
608
|
entry = entry.next;
|
|
654
609
|
}
|
|
655
|
-
if (state.corkedRequestsFree) {
|
|
656
|
-
state.corkedRequestsFree.next = corkReq;
|
|
657
|
-
} else {
|
|
658
|
-
state.corkedRequestsFree = corkReq;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
610
|
|
|
611
|
+
// reuse the free corkReq.
|
|
612
|
+
state.corkedRequestsFree.next = corkReq;
|
|
613
|
+
}
|
|
662
614
|
Object.defineProperty(Writable.prototype, 'destroyed', {
|
|
663
|
-
|
|
615
|
+
// making it explicit this property is not enumerable
|
|
616
|
+
// because otherwise some prototype manipulation in
|
|
617
|
+
// userland will fail
|
|
618
|
+
enumerable: false,
|
|
619
|
+
get: function get() {
|
|
664
620
|
if (this._writableState === undefined) {
|
|
665
621
|
return false;
|
|
666
622
|
}
|
|
667
623
|
return this._writableState.destroyed;
|
|
668
624
|
},
|
|
669
|
-
set: function (value) {
|
|
625
|
+
set: function set(value) {
|
|
670
626
|
// we ignore the value if the stream
|
|
671
627
|
// has not been initialized yet
|
|
672
628
|
if (!this._writableState) {
|
|
@@ -678,10 +634,8 @@ Object.defineProperty(Writable.prototype, 'destroyed', {
|
|
|
678
634
|
this._writableState.destroyed = value;
|
|
679
635
|
}
|
|
680
636
|
});
|
|
681
|
-
|
|
682
637
|
Writable.prototype.destroy = destroyImpl.destroy;
|
|
683
638
|
Writable.prototype._undestroy = destroyImpl.undestroy;
|
|
684
639
|
Writable.prototype._destroy = function (err, cb) {
|
|
685
|
-
this.end();
|
|
686
640
|
cb(err);
|
|
687
641
|
};
|