diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2bab714999..49d686356e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,7 +28,8 @@ release.
-7.7.2
+7.7.3
+7.7.2
7.7.1
7.7.0
7.6.0
diff --git a/benchmark/buffers/buffer-base64-encode.js b/benchmark/buffers/buffer-base64-encode.js
index f618ba21ecf..6805737ba9f 100644
--- a/benchmark/buffers/buffer-base64-encode.js
+++ b/benchmark/buffers/buffer-base64-encode.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
'use strict';
var common = require('../common.js');
diff --git a/benchmark/buffers/buffer-compare.js b/benchmark/buffers/buffer-compare.js
index 84faf84e34a..0a8c4c15e74 100644
--- a/benchmark/buffers/buffer-compare.js
+++ b/benchmark/buffers/buffer-compare.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
'use strict';
var common = require('../common.js');
diff --git a/benchmark/crypto/get-ciphers.js b/benchmark/crypto/get-ciphers.js
index f6b1767cb4f..3f5ad17ad38 100644
--- a/benchmark/crypto/get-ciphers.js
+++ b/benchmark/crypto/get-ciphers.js
@@ -18,6 +18,6 @@ function main(conf) {
method();
}
bench.start();
- for (; i < n; i++) method();
+ for (i = 0; i < n; i++) method();
bench.end(n);
}
diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js
index b359fbbff4b..74ddadbb9da 100644
--- a/benchmark/misc/punycode.js
+++ b/benchmark/misc/punycode.js
@@ -46,7 +46,7 @@ function runPunycode(n, val) {
for (; i < n; i++)
usingPunycode(val);
bench.start();
- for (; i < n; i++)
+ for (i = 0; i < n; i++)
usingPunycode(val);
bench.end(n);
}
diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js
index a175533c7bb..090f7b78549 100644
--- a/benchmark/module/module-loader.js
+++ b/benchmark/module/module-loader.js
@@ -8,7 +8,8 @@ var benchmarkDirectory = path.join(tmpDirectory, 'nodejs-benchmark-module');
var bench = common.createBenchmark(main, {
thousands: [50],
- fullPath: ['true', 'false']
+ fullPath: ['true', 'false'],
+ useCache: ['true', 'false']
});
function main(conf) {
@@ -31,22 +32,34 @@ function main(conf) {
}
if (conf.fullPath === 'true')
- measureFull(n);
+ measureFull(n, conf.useCache === 'true');
else
- measureDir(n);
+ measureDir(n, conf.useCache === 'true');
}
-function measureFull(n) {
+function measureFull(n, useCache) {
+ var i;
+ if (useCache) {
+ for (i = 0; i <= n; i++) {
+ require(benchmarkDirectory + i + '/index.js');
+ }
+ }
bench.start();
- for (var i = 0; i <= n; i++) {
+ for (i = 0; i <= n; i++) {
require(benchmarkDirectory + i + '/index.js');
}
bench.end(n / 1e3);
}
-function measureDir(n) {
+function measureDir(n, useCache) {
+ var i;
+ if (useCache) {
+ for (i = 0; i <= n; i++) {
+ require(benchmarkDirectory + i);
+ }
+ }
bench.start();
- for (var i = 0; i <= n; i++) {
+ for (i = 0; i <= n; i++) {
require(benchmarkDirectory + i);
}
bench.end(n / 1e3);
diff --git a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
index 7e56b5fba6e..2b8d2c36a81 100644
--- a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
+++ b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
@@ -7,7 +7,7 @@ const inputs = require('../fixtures/url-inputs.js').searchParams;
const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
method: ['legacy', 'whatwg'],
- n: [1e5]
+ n: [1e6]
});
function useLegacy(n, input, prop) {
diff --git a/common.gypi b/common.gypi
index c49171fd113..61e40cecd1b 100644
--- a/common.gypi
+++ b/common.gypi
@@ -361,12 +361,12 @@
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="s390"', {
- 'cflags': [ '-m31' ],
- 'ldflags': [ '-m31' ],
+ 'cflags': [ '-m31', '-march=z196' ],
+ 'ldflags': [ '-m31', '-march=z196' ],
}],
[ 'target_arch=="s390x"', {
- 'cflags': [ '-m64' ],
- 'ldflags': [ '-m64' ],
+ 'cflags': [ '-m64', '-march=z196' ],
+ 'ldflags': [ '-m64', '-march=z196' ],
}],
[ 'OS=="solaris"', {
'cflags': [ '-pthreads' ],
diff --git a/deps/chakrashim/include/v8-version.h b/deps/chakrashim/include/v8-version.h
index 7c8bab9546c..ff9450b471d 100644
--- a/deps/chakrashim/include/v8-version.h
+++ b/deps/chakrashim/include/v8-version.h
@@ -34,7 +34,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 326
-#define V8_PATCH_LEVEL 55
+#define V8_PATCH_LEVEL 56
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_duplex.js
index 736693b8400..2b86f23705b 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_duplex.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_duplex.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_passthrough.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_passthrough.js
index d06f71f1868..a9c83588482 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_passthrough.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_passthrough.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_readable.js
index 54a9d5c553d..e06af757262 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_readable.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_readable.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
'use strict';
module.exports = Readable;
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_transform.js
index 625cdc17698..b2ce1a030c8 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_transform.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_transform.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js
index 95916c992a9..4fbcd4b4e3a 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
index ff4c851c075..e6a92b7747e 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
@@ -19,6 +19,27 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/string_decoder/index.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/string_decoder/index.js
index b00e54fb790..b4df147795e 100644
--- a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/string_decoder/index.js
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/string_decoder/index.js
@@ -19,6 +19,27 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
var Buffer = require('buffer').Buffer;
var isBufferEncoding = Buffer.isEncoding
diff --git a/deps/npm/node_modules/read-installed/node_modules/util-extend/extend.js b/deps/npm/node_modules/read-installed/node_modules/util-extend/extend.js
index de9fcf471ab..ad1f4d5b9e7 100644
--- a/deps/npm/node_modules/read-installed/node_modules/util-extend/extend.js
+++ b/deps/npm/node_modules/read-installed/node_modules/util-extend/extend.js
@@ -19,6 +19,27 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
module.exports = extend;
function extend(origin, add) {
// Don't do anything if add isn't an object
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
index 736693b8400..2b86f23705b 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js b/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
index d06f71f1868..a9c83588482 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
index 3a7d42d62b8..78e248106ac 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
'use strict';
module.exports = Readable;
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
index cd2583207f5..244a308870b 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
index 4d9c62ba62f..fa5cb887017 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
@@ -1,3 +1,24 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
diff --git a/deps/npm/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/deps/npm/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
index ff4c851c075..e6a92b7747e 100644
--- a/deps/npm/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
+++ b/deps/npm/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
@@ -19,6 +19,27 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
diff --git a/deps/npm/node_modules/readable-stream/node_modules/string_decoder/index.js b/deps/npm/node_modules/readable-stream/node_modules/string_decoder/index.js
index b00e54fb790..b4df147795e 100644
--- a/deps/npm/node_modules/readable-stream/node_modules/string_decoder/index.js
+++ b/deps/npm/node_modules/readable-stream/node_modules/string_decoder/index.js
@@ -19,6 +19,27 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
var Buffer = require('buffer').Buffer;
var isBufferEncoding = Buffer.isEncoding
diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h
index b6949876330..bb5cb29c136 100644
--- a/deps/v8/include/v8-version.h
+++ b/deps/v8/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 326
-#define V8_PATCH_LEVEL 55
+#define V8_PATCH_LEVEL 56
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/v8/src/objects.cc b/deps/v8/src/objects.cc
index e711a219259..15773748ed5 100644
--- a/deps/v8/src/objects.cc
+++ b/deps/v8/src/objects.cc
@@ -7330,7 +7330,13 @@ namespace {
Maybe GetPropertyDescriptorWithInterceptor(LookupIterator* it,
PropertyDescriptor* desc) {
- if (it->state() == LookupIterator::INTERCEPTOR) {
+ bool has_access = true;
+ if (it->state() == LookupIterator::ACCESS_CHECK) {
+ has_access = it->HasAccess() || JSObject::AllCanRead(it);
+ it->Next();
+ }
+
+ if (has_access && it->state() == LookupIterator::INTERCEPTOR) {
Isolate* isolate = it->isolate();
Handle interceptor = it->GetInterceptor();
if (!interceptor->descriptor()->IsUndefined(isolate)) {
@@ -7374,6 +7380,7 @@ Maybe GetPropertyDescriptorWithInterceptor(LookupIterator* it,
}
}
}
+ it->Restart();
return Just(false);
}
} // namespace
diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc
index 572487976e9..396efca01d4 100644
--- a/deps/v8/test/cctest/test-api-interceptors.cc
+++ b/deps/v8/test/cctest/test-api-interceptors.cc
@@ -609,6 +609,50 @@ THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) {
CHECK_EQ(set_was_called, false);
}
+namespace {
+int descriptor_was_called;
+
+void PropertyDescriptorCallback(
+ Local name, const v8::PropertyCallbackInfo& info) {
+ // Intercept the callback by setting a different descriptor.
+ descriptor_was_called++;
+ const char* code =
+ "var desc = {value: 5};"
+ "desc;";
+ Local descriptor = v8_compile(code)
+ ->Run(info.GetIsolate()->GetCurrentContext())
+ .ToLocalChecked();
+ info.GetReturnValue().Set(descriptor);
+}
+} // namespace
+
+// Check that the descriptor callback is called on the global object.
+THREADED_TEST(DescriptorCallbackOnGlobalObject) {
+ v8::HandleScope scope(CcTest::isolate());
+ LocalContext env;
+ v8::Local templ =
+ v8::FunctionTemplate::New(CcTest::isolate());
+
+ v8::Local object_template = templ->InstanceTemplate();
+ object_template->SetHandler(v8::NamedPropertyHandlerConfiguration(
+ nullptr, nullptr, PropertyDescriptorCallback, nullptr, nullptr, nullptr));
+ v8::Local ctx =
+ v8::Context::New(CcTest::isolate(), nullptr, object_template);
+
+ descriptor_was_called = 0;
+
+ // Declare function.
+ v8::Local code = v8_str(
+ "var x = 42; var desc = Object.getOwnPropertyDescriptor(this, 'x'); "
+ "desc.value;");
+ CHECK_EQ(5, v8::Script::Compile(ctx, code)
+ .ToLocalChecked()
+ ->Run(ctx)
+ .ToLocalChecked()
+ ->Int32Value(ctx)
+ .FromJust());
+ CHECK_EQ(1, descriptor_was_called);
+}
bool get_was_called_in_order = false;
bool define_was_called_in_order = false;
@@ -4516,7 +4560,7 @@ TEST(NamedAllCanReadInterceptor) {
ExpectInt32("checked.whatever", 17);
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')")
->IsUndefined());
- CHECK_EQ(5, access_check_data.count);
+ CHECK_EQ(6, access_check_data.count);
access_check_data.result = false;
ExpectInt32("checked.whatever", intercept_data_0.value);
@@ -4525,7 +4569,7 @@ TEST(NamedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(7, access_check_data.count);
+ CHECK_EQ(9, access_check_data.count);
intercept_data_1.should_intercept = true;
ExpectInt32("checked.whatever", intercept_data_1.value);
@@ -4534,7 +4578,7 @@ TEST(NamedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(9, access_check_data.count);
+ CHECK_EQ(12, access_check_data.count);
g_access_check_data = nullptr;
}
@@ -4603,7 +4647,7 @@ TEST(IndexedAllCanReadInterceptor) {
ExpectInt32("checked[15]", 17);
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
->IsUndefined());
- CHECK_EQ(5, access_check_data.count);
+ CHECK_EQ(6, access_check_data.count);
access_check_data.result = false;
ExpectInt32("checked[15]", intercept_data_0.value);
@@ -4612,7 +4656,7 @@ TEST(IndexedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(7, access_check_data.count);
+ CHECK_EQ(9, access_check_data.count);
intercept_data_1.should_intercept = true;
ExpectInt32("checked[15]", intercept_data_1.value);
@@ -4621,7 +4665,7 @@ TEST(IndexedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(9, access_check_data.count);
+ CHECK_EQ(12, access_check_data.count);
g_access_check_data = nullptr;
}
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 70e13f3b877..14de5af2ed9 100644
--- a/doc/api/assert.md
+++ b/doc/api/assert.md
@@ -125,12 +125,13 @@ changes:
* `expected` {any}
* `message` {any}
-Generally identical to `assert.deepEqual()` with two exceptions:
+Generally identical to `assert.deepEqual()` with three exceptions:
1. Primitive values are compared using the [Strict Equality Comparison][]
( `===` ).
2. [`[[Prototype]]`][prototype-spec] of objects are compared using
the [Strict Equality Comparison][] too.
+3. [Type tags][Object.prototype.toString()] of objects should be the same.
```js
const assert = require('assert');
@@ -141,6 +142,25 @@ assert.deepEqual({a: 1}, {a: '1'});
assert.deepStrictEqual({a: 1}, {a: '1'});
// AssertionError: { a: 1 } deepStrictEqual { a: '1' }
// because 1 !== '1' using strict equality
+
+// The following objects don't have own properties
+const date = new Date();
+const object = {};
+const fakeDate = {};
+
+Object.setPrototypeOf(fakeDate, Date.prototype);
+
+assert.deepEqual(object, fakeDate);
+// OK, doesn't check [[Prototype]]
+assert.deepStrictEqual(object, fakeDate);
+// AssertionError: {} deepStrictEqual Date {}
+// Different [[Prototype]]
+
+assert.deepEqual(date, fakeDate);
+// OK, doesn't check type tags
+assert.deepStrictEqual(date, fakeDate);
+// AssertionError: 2017-03-11T14:25:31.849Z deepStrictEqual Date {}
+// Different type tags
```
If the values are not equal, an `AssertionError` is thrown with a `message`
@@ -579,4 +599,5 @@ For more information, see
[SameValueZero]: https://tc39.github.io/ecma262/#sec-samevaluezero
[prototype-spec]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
[mdn-equality-guide]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness
-[enumerable "own" properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
\ No newline at end of file
+[enumerable "own" properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
+[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index 39bde058a3e..7c1f5373d99 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -135,8 +135,9 @@ added: v0.1.90
understand the `-c` switch on UNIX or `/d /s /c` on Windows. On Windows,
command line parsing should be compatible with `cmd.exe`.)
* `timeout` {number} (Default: `0`)
- * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
- stdout or stderr - if exceeded child process is killed (Default: `200*1024`)
+ * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
+ stderr. (Default: `200*1024`) If exceeded, the child process is terminated.
+ See caveat at [`maxBuffer` and Unicode][].
* `killSignal` {string|integer} (Default: `'SIGTERM'`)
* `uid` {number} Sets the user identity of the process. (See setuid(2).)
* `gid` {number} Sets the group identity of the process. (See setgid(2).)
@@ -193,7 +194,7 @@ the process is spawned. The default options are:
}
```
-If `timeout` is greater than `0`, the parent will send the the signal
+If `timeout` is greater than `0`, the parent will send the signal
identified by the `killSignal` property (the default is `'SIGTERM'`) if the
child runs longer than `timeout` milliseconds.
@@ -212,8 +213,9 @@ added: v0.1.91
* `env` {Object} Environment key-value pairs
* `encoding` {string} (Default: `'utf8'`)
* `timeout` {number} (Default: `0`)
- * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
- stdout or stderr - if exceeded child process is killed (Default: `200*1024`)
+ * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
+ stderr. (Default: `200*1024`) If exceeded, the child process is terminated.
+ See caveat at [`maxBuffer` and Unicode][].
* `killSignal` {string|integer} (Default: `'SIGTERM'`)
* `uid` {number} Sets the user identity of the process. (See setuid(2).)
* `gid` {number} Sets the group identity of the process. (See setgid(2).)
@@ -618,8 +620,9 @@ changes:
is allowed to run. (Default: `undefined`)
* `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
- stdout or stderr - if exceeded child process is killed
+ * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
+ stderr. (Default: `200*1024`) If exceeded, the child process is terminated.
+ See caveat at [`maxBuffer` and Unicode][].
* `encoding` {string} The encoding used for all stdio inputs and outputs. (Default: `'buffer'`)
* Returns: {Buffer|string} The stdout from the command
@@ -664,8 +667,9 @@ changes:
is allowed to run. (Default: `undefined`)
* `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
- stdout or stderr - if exceeded child process is killed
+ * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
+ stderr. (Default: `200*1024`) If exceeded, the child process is terminated.
+ See caveat at [`maxBuffer` and Unicode][].
* `encoding` {string} The encoding used for all stdio inputs and outputs.
(Default: `'buffer'`)
* Returns: {Buffer|string} The stdout from the command
@@ -716,8 +720,9 @@ changes:
is allowed to run. (Default: `undefined`)
* `killSignal` {string|integer} The signal value to be used when the spawned
process will be killed. (Default: `'SIGTERM'`)
- * [`maxBuffer`][] {number} largest amount of data (in bytes) allowed on
- stdout or stderr - if exceeded child process is killed
+ * `maxBuffer` {number} Largest amount of data in bytes allowed on stdout or
+ stderr. (Default: `200*1024`) If exceeded, the child process is terminated.
+ See caveat at [`maxBuffer` and Unicode][].
* `encoding` {string} The encoding used for all stdio inputs and outputs.
(Default: `'buffer'`)
* `shell` {boolean|string} If `true`, runs `command` inside of a shell. Uses
@@ -1235,7 +1240,7 @@ to `stdout` although there are only 4 characters.
[`Error`]: errors.html#errors_class_error
[`EventEmitter`]: events.html#events_class_eventemitter
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
-[`maxBuffer`]: #child_process_maxbuffer_and_unicode
+[`maxBuffer` and Unicode]: #child_process_maxbuffer_and_unicode
[`net.Server`]: net.html#net_class_net_server
[`net.Socket`]: net.html#net_class_net_socket
[`options.detached`]: #child_process_options_detached
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index e901edf5fd3..9557273a9b7 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -62,11 +62,9 @@ const cert2 = crypto.Certificate();
-
-The `spkac` data structure includes a public key and a challenge. The
-`certificate.exportChallenge()` returns the challenge component in the
-form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string
-or a [`Buffer`][].
+- `spkac` {string | Buffer}
+- Returns {Buffer} The challenge component of the `spkac` data structure, which
+includes a public key and a challenge.
```js
const cert = require('crypto').Certificate();
@@ -80,11 +78,9 @@ console.log(challenge.toString('utf8'));
-
-The `spkac` data structure includes a public key and a challenge. The
-`certificate.exportPublicKey()` returns the public key component in the
-form of a Node.js [`Buffer`][]. The `spkac` argument can be either a string
-or a [`Buffer`][].
+- `spkac` {string | Buffer}
+- Returns {Buffer} The public key component of the `spkac` data structure,
+which includes a public key and a challenge.
```js
const cert = require('crypto').Certificate();
@@ -98,9 +94,9 @@ console.log(publicKey);
-
-Returns `true` if the given `spkac` data structure is valid, `false` otherwise.
-The `spkac` argument must be a Node.js [`Buffer`][].
+- `spkac` {Buffer}
+- Returns {boolean} `true` if the given `spkac` data structure is valid, `false`
+otherwise.
```js
const cert = require('crypto').Certificate();
@@ -176,6 +172,7 @@ console.log(encrypted);
+- `output_encoding` {string}
Returns any remaining enciphered contents. If `output_encoding`
parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned.
@@ -189,6 +186,8 @@ once will result in an error being thrown.
+- `buffer` {Buffer}
+- Returns the {Cipher} for method chaining.
When using an authenticated encryption mode (only `GCM` is currently
supported), the `cipher.setAAD()` method sets the value used for the
@@ -196,8 +195,6 @@ _additional authenticated data_ (AAD) input parameter.
The `cipher.setAAD()` method must be called before [`cipher.update()`][].
-Returns `this` for method chaining.
-
### cipher.getAuthTag()
+- `auto_padding` {boolean} Defaults to `true`.
+- Returns the {Cipher} for method chaining.
When using block encryption algorithms, the `Cipher` class will automatically
add padding to the input data to the appropriate block size. To disable the
@@ -227,8 +226,6 @@ using `0x0` instead of PKCS padding.
The `cipher.setAutoPadding()` method must be called before
[`cipher.final()`][].
-Returns `this` for method chaining.
-
### cipher.update(data[, input_encoding][, output_encoding])
+- `data` {string | Buffer}
+- `input_encoding` {string}
+- `output_encoding` {string}
Updates the cipher with `data`. If the `input_encoding` argument is given,
its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data`
@@ -322,6 +322,7 @@ console.log(decrypted);
+- `output_encoding` {string}
Returns any remaining deciphered contents. If `output_encoding`
parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned.
@@ -339,6 +340,8 @@ changes:
pr-url: https://github.com/nodejs/node/pull/9398
description: This method now returns a reference to `decipher`.
-->
+- `buffer` {Buffer}
+- Returns the {Cipher} for method chaining.
When using an authenticated encryption mode (only `GCM` is currently
supported), the `decipher.setAAD()` method sets the value used for the
@@ -346,8 +349,6 @@ _additional authenticated data_ (AAD) input parameter.
The `decipher.setAAD()` method must be called before [`decipher.update()`][].
-Returns `this` for method chaining.
-
### decipher.setAuthTag(buffer)
+- `buffer` {Buffer}
+- Returns the {Cipher} for method chaining.
When using an authenticated encryption mode (only `GCM` is currently
supported), the `decipher.setAuthTag()` method is used to pass in the
@@ -366,12 +369,12 @@ cipher text should be discarded due to failed authentication.
The `decipher.setAuthTag()` method must be called before
[`decipher.final()`][].
-Returns `this` for method chaining.
-
-### decipher.setAutoPadding(auto_padding=true)
+### decipher.setAutoPadding([auto_padding])
+- `auto_padding` {boolean} Defaults to `true`.
+- Returns the {Cipher} for method chaining.
When data has been encrypted without standard block padding, calling
`decipher.setAutoPadding(false)` will disable automatic padding to prevent
@@ -383,8 +386,6 @@ multiple of the ciphers block size.
The `decipher.setAutoPadding()` method must be called before
[`decipher.final()`][].
-Returns `this` for method chaining.
-
### decipher.update(data[, input_encoding][, output_encoding])
+- `data` {string | Buffer}
+- `input_encoding` {string}
+- `output_encoding` {string}
Updates the decipher with `data`. If the `input_encoding` argument is given,
its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data`
@@ -444,6 +448,9 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
+- `other_public_key` {string | Buffer}
+- `input_encoding` {string}
+- `output_encoding` {string}
Computes the shared secret using `other_public_key` as the other
party's public key and returns the computed shared secret. The supplied
@@ -459,6 +466,7 @@ If `output_encoding` is given a string is returned; otherwise, a
+- `encoding` {string}
Generates private and public Diffie-Hellman key values, and returns
the public key in the specified `encoding`. This key should be
@@ -470,6 +478,7 @@ or `'base64'`. If `encoding` is provided a string is returned; otherwise a
+- `encoding` {string}
Returns the Diffie-Hellman generator in the specified `encoding`, which can
be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
@@ -479,6 +488,7 @@ returned; otherwise a [`Buffer`][] is returned.
+- `encoding` {string}
Returns the Diffie-Hellman prime in the specified `encoding`, which can
be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
@@ -488,6 +498,7 @@ returned; otherwise a [`Buffer`][] is returned.
+- `encoding` {string}
Returns the Diffie-Hellman private key in the specified `encoding`,
which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a
@@ -497,6 +508,7 @@ string is returned; otherwise a [`Buffer`][] is returned.
+- `encoding` {string}
Returns the Diffie-Hellman public key in the specified `encoding`, which
can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a
@@ -506,6 +518,8 @@ string is returned; otherwise a [`Buffer`][] is returned.
+- `private_key` {string | Buffer}
+- `encoding` {string}
Sets the Diffie-Hellman private key. If the `encoding` argument is provided
and is either `'latin1'`, `'hex'`, or `'base64'`, `private_key` is expected
@@ -516,6 +530,8 @@ to be a [`Buffer`][].
+- `public_key` {string | Buffer}
+- `encoding` {string}
Sets the Diffie-Hellman public key. If the `encoding` argument is provided
and is either `'latin1'`, `'hex'` or `'base64'`, `public_key` is expected
@@ -577,6 +593,9 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5522
description: The default `input_encoding` changed from `binary` to `utf8`.
-->
+- `other_public_key` {string | Buffer}
+- `input_encoding` {string}
+- `output_encoding` {string}
Computes the shared secret using `other_public_key` as the other
party's public key and returns the computed shared secret. The supplied
@@ -592,6 +611,8 @@ If `output_encoding` is given a string will be returned; otherwise a
+- `encoding` {string}
+- `format` {string} Defaults to `uncompressed`.
Generates private and public EC Diffie-Hellman key values, and returns
the public key in the specified `format` and `encoding`. This key should be
@@ -609,15 +630,18 @@ is returned.
+- `encoding` {string}
Returns the EC Diffie-Hellman private key in the specified `encoding`,
which can be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided
a string is returned; otherwise a [`Buffer`][] is returned.
-### ecdh.getPublicKey([encoding[, format]])
+### ecdh.getPublicKey([encoding][, format])
+- `encoding` {string}
+- `format` {string} Defaults to `uncompressed`.
Returns the EC Diffie-Hellman public key in the specified `encoding` and
`format`.
@@ -634,6 +658,8 @@ returned.
+- `private_key` {string | Buffer}
+- `encoding` {string}
Sets the EC Diffie-Hellman private key. The `encoding` can be `'latin1'`,
`'hex'` or `'base64'`. If `encoding` is provided, `private_key` is expected
@@ -650,6 +676,9 @@ deprecated: v5.2.0
> Stability: 0 - Deprecated
+- `public_key` {string | Buffer}
+- `encoding` {string}
+
Sets the EC Diffie-Hellman public key. Key encoding can be `'latin1'`,
`'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to
be a string; otherwise a [`Buffer`][] is expected.
@@ -747,6 +776,7 @@ console.log(hash.digest('hex'));
+- `encoding` {string}
Calculates the digest of all of the data passed to be hashed (using the
[`hash.update()`][] method). The `encoding` can be `'hex'`, `'latin1'` or
@@ -764,6 +794,8 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5522
description: The default `input_encoding` changed from `binary` to `utf8`.
-->
+- `data` {string | Buffer}
+- `input_encoding` {string}
Updates the hash content with the given `data`, the encoding of which
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
@@ -834,6 +866,7 @@ console.log(hmac.digest('hex'));
+- `encoding` {string}
Calculates the HMAC digest of all of the data passed using [`hmac.update()`][].
The `encoding` can be `'hex'`, `'latin1'` or `'base64'`. If `encoding` is
@@ -850,6 +883,8 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5522
description: The default `input_encoding` changed from `binary` to `utf8`.
-->
+- `data` {string | Buffer}
+- `input_encoding` {string}
Updates the `Hmac` content with the given `data`, the encoding of which
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
@@ -929,6 +964,10 @@ console.log(sign.sign(privateKey).toString('hex'));
+- `private_key` {string | Object}
+ - `key` {string}
+ - `passphrase` {string}
+- `output_format` {string}
Calculates the signature on all the data passed through using either
[`sign.update()`][] or [`sign.write()`][stream-writable-write].
@@ -955,6 +994,8 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5522
description: The default `input_encoding` changed from `binary` to `utf8`.
-->
+- `data` {string | Buffer}
+- `input_encoding` {string}
Updates the `Sign` content with the given `data`, the encoding of which
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
@@ -1017,6 +1058,8 @@ changes:
pr-url: https://github.com/nodejs/node/pull/5522
description: The default `input_encoding` changed from `binary` to `utf8`.
-->
+- `data` {string | Buffer}
+- `input_encoding` {string}
Updates the `Verify` content with the given `data`, the encoding of which
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
@@ -1030,10 +1073,13 @@ This can be called many times with new data as it is streamed.
+- `object` {string}
+- `signature` {string | Buffer}
+- `signature_format` {string}
Verifies the provided data using the given `object` and `signature`.
The `object` argument is a string containing a PEM encoded object, which can be
-one an RSA public key, a DSA public key, or an X.509 certificate.
+an RSA public key, a DSA public key, or an X.509 certificate.
The `signature` argument is the previously calculated signature for the data, in
the `signature_format` which can be `'latin1'`, `'hex'` or `'base64'`.
If a `signature_format` is specified, the `signature` is expected to be a
@@ -1084,6 +1130,8 @@ currently in use. Setting to true requires a FIPS build of Node.js.
+- `algorithm` {string}
+- `password` {string | Buffer}
Creates and returns a `Cipher` object that uses the given `algorithm` and
`password`.
@@ -1108,6 +1156,9 @@ their own using [`crypto.pbkdf2()`][] and to use [`crypto.createCipheriv()`][]
to create the `Cipher` object.
### crypto.createCipheriv(algorithm, key, iv)
+- `algorithm` {string}
+- `key` {string | Buffer}
+- `iv` {string | Buffer}
Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
initialization vector (`iv`).
@@ -1142,6 +1193,8 @@ called.
+- `algorithm` {string}
+- `password` {string | Buffer}
Creates and returns a `Decipher` object that uses the given `algorithm` and
`password` (key).
@@ -1162,6 +1215,9 @@ to create the `Decipher` object.
+- `algorithm` {string}
+- `key` {string | Buffer}
+- `iv` {string | Buffer}
Creates and returns a `Decipher` object that uses the given `algorithm`, `key`
and initialization vector (`iv`).
@@ -1183,6 +1239,10 @@ changes:
description: The default for the encoding parameters changed
from `binary` to `utf8`.
-->
+- `prime` {string | Buffer}
+- `prime_encoding` {string}
+- `generator` {number | string | Buffer} Defaults to `2`.
+- `generator_encoding` {string}
Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
optional specific `generator`.
@@ -1203,6 +1263,8 @@ otherwise either a number or [`Buffer`][] is expected.
+- `prime_length` {number}
+- `generator` {number | string | Buffer} Defaults to `2`.
Creates a `DiffieHellman` key exchange object and generates a prime of
`prime_length` bits using an optional specific numeric `generator`.
@@ -1212,6 +1274,7 @@ If `generator` is not specified, the value `2` is used.
+- `curve_name` {string}
Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
predefined curve specified by the `curve_name` string. Use
@@ -1223,6 +1286,7 @@ and description of each available elliptic curve.
+- `algorithm` {string}
Creates and returns a `Hash` object that can be used to generate hash digests
using the given `algorithm`.
@@ -1256,6 +1320,8 @@ input.on('readable', () => {
+- `algorithm` {string}
+- `key` {string | Buffer}
Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
@@ -1290,6 +1356,7 @@ input.on('readable', () => {
+- `algorithm` {string}
Creates and returns a `Sign` object that uses the given `algorithm`.
Use [`crypto.getHashes()`][] to obtain an array of names of the available
@@ -1299,6 +1366,7 @@ signing algorithms.
+- `algorithm` {string}
Creates and returns a `Verify` object that uses the given algorithm.
Use [`crypto.getHashes()`][] to obtain an array of names of the available
@@ -1336,6 +1404,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
+- `group_name` {string}
Creates a predefined `DiffieHellman` key exchange object. The
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in
@@ -1396,6 +1465,14 @@ changes:
description: The default encoding for `password` if it is a string changed
from `binary` to `utf8`.
-->
+- `password` {string}
+- `salt` {string}
+- `iterations` {number}
+- `keylen` {number}
+- `digest` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `derivedKey` {Buffer}
Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
implementation. A selected HMAC digest algorithm specified by `digest` is
@@ -1418,9 +1495,9 @@ Example:
```js
const crypto = require('crypto');
-crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, key) => {
+crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => {
if (err) throw err;
- console.log(key.toString('hex')); // '3745e48...aa39b34'
+ console.log(derivedKey.toString('hex')); // '3745e48...aa39b34'
});
```
@@ -1440,6 +1517,11 @@ changes:
description: The default encoding for `password` if it is a string changed
from `binary` to `utf8`.
-->
+- `password` {string}
+- `salt` {string}
+- `iterations` {number}
+- `keylen` {number}
+- `digest` {string}
Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
implementation. A selected HMAC digest algorithm specified by `digest` is
@@ -1472,95 +1554,84 @@ An array of supported digest functions can be retrieved using
+- `private_key` {Object | string}
+ - `key` {string} A PEM encoded private key.
+ - `passphrase` {string} An optional passphrase for the private key.
+ - `padding` {crypto.constants} An optional padding value defined in
+ `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
+ `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
+- `buffer` {Buffer}
Decrypts `buffer` with `private_key`.
`private_key` can be an object or a string. If `private_key` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
-If `private_key` is an object, it is interpreted as a hash object with the
-keys:
-
-* `key`: {string} - PEM encoded private key
-* `passphrase`: {string} - Optional passphrase for the private key
-* `padding` : An optional padding value, one of the following:
- * `crypto.constants.RSA_NO_PADDING`
- * `crypto.constants.RSA_PKCS1_PADDING`
- * `crypto.constants.RSA_PKCS1_OAEP_PADDING`
-
-All paddings are defined in `crypto.constants`.
### crypto.privateEncrypt(private_key, buffer)
+- `private_key` {Object | string}
+ - `key` {string} A PEM encoded private key.
+ - `passphrase` {string} An optional passphrase for the private key.
+ - `padding` {crypto.constants} An optional padding value defined in
+ `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING` or
+ `RSA_PKCS1_PADDING`.
+- `buffer` {Buffer}
Encrypts `buffer` with `private_key`.
`private_key` can be an object or a string. If `private_key` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
-If `private_key` is an object, it is interpreted as a hash object with the
-keys:
-
-* `key`: {string} - PEM encoded private key
-* `passphrase`: {string} - Optional passphrase for the private key
-* `padding` : An optional padding value, one of the following:
- * `crypto.constants.RSA_NO_PADDING`
- * `crypto.constants.RSA_PKCS1_PADDING`
-
-All paddings are defined in `crypto.constants`.
### crypto.publicDecrypt(public_key, buffer)
+- `private_key` {Object | string}
+ - `key` {string} A PEM encoded private key.
+ - `passphrase` {string} An optional passphrase for the private key.
+ - `padding` {crypto.constants} An optional padding value defined in
+ `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
+ `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
+- `buffer` {Buffer}
Decrypts `buffer` with `public_key`.
`public_key` can be an object or a string. If `public_key` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
-If `public_key` is an object, it is interpreted as a hash object with the
-keys:
-
-* `key`: {string} - PEM encoded public key
-* `passphrase`: {string} - Optional passphrase for the private key
-* `padding` : An optional padding value, one of the following:
- * `crypto.constants.RSA_NO_PADDING`
- * `crypto.constants.RSA_PKCS1_PADDING`
- * `crypto.constants.RSA_PKCS1_OAEP_PADDING`
Because RSA public keys can be derived from private keys, a private key may
be passed instead of a public key.
-All paddings are defined in `crypto.constants`.
-
### crypto.publicEncrypt(public_key, buffer)
+- `private_key` {Object | string}
+ - `key` {string} A PEM encoded private key.
+ - `passphrase` {string} An optional passphrase for the private key.
+ - `padding` {crypto.constants} An optional padding value defined in
+ `crypto.constants`, which may be: `crypto.constants.RSA_NO_PADDING`,
+ `RSA_PKCS1_PADDING`, or `crypto.constants.RSA_PKCS1_OAEP_PADDING`.
+- `buffer` {Buffer}
Encrypts `buffer` with `public_key`.
`public_key` can be an object or a string. If `public_key` is a string, it is
treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
-If `public_key` is an object, it is interpreted as a hash object with the
-keys:
-
-* `key`: {string} - PEM encoded public key
-* `passphrase`: {string} - Optional passphrase for the private key
-* `padding` : An optional padding value, one of the following:
- * `crypto.constants.RSA_NO_PADDING`
- * `crypto.constants.RSA_PKCS1_PADDING`
- * `crypto.constants.RSA_PKCS1_OAEP_PADDING`
Because RSA public keys can be derived from private keys, a private key may
be passed instead of a public key.
-All paddings are defined in `crypto.constants`.
-
### crypto.randomBytes(size[, callback])
+- `size` {number}
+- `callback` {Function}
+ - `err` {Error}
+ - `buf` {Buffer}
Generates cryptographically strong pseudo-random data. The `size` argument
is a number indicating the number of bytes to generate.
@@ -1599,6 +1670,8 @@ time is right after boot, when the whole system is still low on entropy.
+- `engine` {string}
+- `flags` {crypto.constants} Defaults to `crypto.constants.ENGINE_METHOD_ALL`.
Load and set the `engine` for some or all OpenSSL functions (selected by flags).
@@ -1626,6 +1699,8 @@ is a bit field taking one of or a mix of the following flags (defined in
+- `a` {Buffer}
+- `b` {Buffer}
Returns true if `a` is equal to `b`, without leaking timing information that
would allow an attacker to guess one of the values. This is suitable for
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md
index 786a6453161..8de386118af 100644
--- a/doc/api/deprecations.md
+++ b/doc/api/deprecations.md
@@ -556,6 +556,32 @@ The `NODE_REPL_MODE` environment variable is used to set the underlying
`replMode` of an interactive `node` session. Its default value, `magic`, is
similarly deprecated in favor of `sloppy`.
+
+### DEP0066: outgoingMessage.\_headers, outgoingMessage.\_headerNames
+
+Type: Documentation-only
+
+The `http` module `outgoingMessage._headers` and `outgoingMessage._headerNames`
+properties have been deprecated. Please instead use one of the public methods
+(e.g. `outgoingMessage.getHeader()`, `outgoingMessage.getHeaders()`,
+`outgoingMessage.getHeaderNames()`, `outgoingMessage.hasHeader()`,
+`outgoingMessage.removeHeader()`, `outgoingMessage.setHeader()`) for working
+with outgoing headers.
+
+*Note*: `outgoingMessage._headers` and `outgoingMessage._headerNames` were never
+documented as officially supported properties.
+
+
+### DEP0067: OutgoingMessage.prototype.\_renderHeaders
+
+Type: Documentation-only
+
+The `http` module `OutgoingMessage.prototype._renderHeaders()` API has been
+deprecated.
+
+*Note*: `OutgoingMessage.prototype._renderHeaders` was never documented as
+an officially supported API.
+
[alloc]: buffer.html#buffer_class_method_buffer_alloc_size_fill_encoding
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
diff --git a/doc/api/dns.md b/doc/api/dns.md
index 7f075be3114..45d494eab3b 100644
--- a/doc/api/dns.md
+++ b/doc/api/dns.md
@@ -70,33 +70,25 @@ changes:
pr-url: https://github.com/nodejs/node/pull/744
description: The `all` option is supported now.
-->
+- `hostname` {string}
+- `options` {integer | Object}
+ - `family` {integer} The record family. Must be `4` or `6`. IPv4
+ and IPv6 addresses are both returned by default.
+ - `hints` {number} One or more [supported `getaddrinfo` flags][]. Multiple
+ flags may be passed by bitwise `OR`ing their values.
+ - `all` {boolean} When `true`, the callback returns all resolved addresses in
+ an array. Otherwise, returns a single address. Defaults to `false`.
+- `callback` {Function}
+ - `err` {Error}
+ - `address` {string} A string representation of an IPv4 or IPv6 address.
+ - `family` {integer} `4` or `6`, denoting the family of `address`.
Resolves a hostname (e.g. `'nodejs.org'`) into the first found A (IPv4) or
-AAAA (IPv6) record. `options` can be an object or integer. If `options` is
-not provided, then IPv4 and IPv6 addresses are both valid. If `options` is
-an integer, then it must be `4` or `6`.
-
-Alternatively, `options` can be an object containing these properties:
-
-* `family` {number} - The record family. If present, must be the integer
- `4` or `6`. If not provided, both IP v4 and v6 addresses are accepted.
-* `hints`: {number} - If present, it should be one or more of the supported
- `getaddrinfo` flags. If `hints` is not provided, then no flags are passed to
- `getaddrinfo`. Multiple flags can be passed through `hints` by bitwise
- `OR`ing their values.
- See [supported `getaddrinfo` flags][] for more information on supported
- flags.
-* `all`: {boolean} - When `true`, the callback returns all resolved addresses
- in an array, otherwise returns a single address. Defaults to `false`.
-
-All properties are optional.
-
-The `callback` function has arguments `(err, address, family)`. `address` is a
-string representation of an IPv4 or IPv6 address. `family` is either the
-integer `4` or `6` and denotes the family of `address` (not necessarily the
-value initially passed to `lookup`).
-
-With the `all` option set to `true`, the arguments change to
+AAAA (IPv6) record. All `option` properties are optional. If `options` is an
+integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
+and IPv6 addresses are both returned if found.
+
+With the `all` option set to `true`, the arguments for `callback` change to
`(err, addresses)`, with `addresses` being an array of objects with the
properties `address` and `family`.
@@ -147,6 +139,12 @@ on some operating systems (e.g FreeBSD 10.1).
+- `address` {string}
+- `port` {number}
+- `callback` {Function}
+ - `err` {Error}
+ - `hostname` {string} e.g. `example.com`
+ - `service` {string} e.g. `http`
Resolves the given `address` and `port` into a hostname and service using
the operating system's underlying `getnameinfo` implementation.
@@ -155,10 +153,7 @@ If `address` is not a valid IP address, a `TypeError` will be thrown.
The `port` will be coerced to a number. If it is not a legal port, a `TypeError`
will be thrown.
-The callback has arguments `(err, hostname, service)`. The `hostname` and
-`service` arguments are strings (e.g. `'localhost'` and `'http'` respectively).
-
-On error, `err` is an [`Error`][] object, where `err.code` is the error code.
+On an error, `err` is an [`Error`][] object, where `err.code` is the error code.
```js
const dns = require('dns');
@@ -172,6 +167,11 @@ dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
+- `hostname` {string}
+- `rrtype` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[] | Object[] | string[][] | Object}
Uses the DNS protocol to resolve a hostname (e.g. `'nodejs.org'`) into an
array of the record types specified by `rrtype`.
@@ -208,18 +208,21 @@ changes:
description: This method now supports passing `options`,
specifically `options.ttl`.
-->
+- `hostname` {string} Hostname to resolve.
+- `options` {Object}
+ - `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
+ When `true`, the callback receives an array of
+ `{ address: '1.2.3.4', ttl: 60 }` objects rather than an array of strings,
+ with the TTL expressed in seconds.
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[] | Object[]}
Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the
`hostname`. The `addresses` argument passed to the `callback` function
will contain an array of IPv4 addresses (e.g.
`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
-* `hostname` {string} Hostname to resolve.
-* `options` {Object}
- * `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
- The callback receives an array of `{ address: '1.2.3.4', ttl: 60 }` objects
- rather than an array of strings. The TTL is expressed in seconds.
-* `callback` {Function} An `(err, result)` callback function.
## dns.resolve6(hostname[, options], callback)
+- `hostname` {string} Hostname to resolve.
+- `options` {Object}
+ - `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
+ When `true`, the callback receives an array of
+ `{ address: '0:1:2:3:4:5:6:7', ttl: 60 }` objects rather than an array of
+ strings, with the TTL expressed in seconds.
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[] | Object[]}
Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the
`hostname`. The `addresses` argument passed to the `callback` function
will contain an array of IPv6 addresses.
-* `hostname` {string} Hostname to resolve.
-* `options` {Object}
- * `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
- The callback receives an array of `{ address: '0:1:2:3:4:5:6:7', ttl: 60 }`
- objects rather than an array of strings. The TTL is expressed in seconds.
-* `callback` {Function} An `(err, result)` callback function.
## dns.resolveCname(hostname, callback)
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[]}
Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The
`addresses` argument passed to the `callback` function
@@ -256,6 +266,10 @@ will contain an array of canonical name records available for the `hostname`
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {Object[]}
Uses the DNS protocol to resolve mail exchange records (`MX` records) for the
`hostname`. The `addresses` argument passed to the `callback` function will
@@ -266,11 +280,14 @@ property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {Object[]}
Uses the DNS protocol to resolve regular expression based records (`NAPTR`
-records) for the `hostname`. The `callback` function has arguments
-`(err, addresses)`. The `addresses` argument passed to the `callback` function
-will contain an array of objects with the following properties:
+records) for the `hostname`. The `addresses` argument passed to the `callback`
+function will contain an array of objects with the following properties:
* `flags`
* `service`
@@ -296,16 +313,24 @@ For example:
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[]}
Uses the DNS protocol to resolve name server records (`NS` records) for the
`hostname`. The `addresses` argument passed to the `callback` function will
contain an array of name server records available for `hostname`
(e.g. `['ns1.example.com', 'ns2.example.com']`).
-## dns.resolvePtr(hostname, callback)
+## dns.resolvePtr(hostname)
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[]}
Uses the DNS protocol to resolve pointer records (`PTR` records) for the
`hostname`. The `addresses` argument passed to the `callback` function will
@@ -315,9 +340,13 @@ be an array of strings containing the reply records.
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `address` {Object}
Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
-the `hostname`. The `addresses` argument passed to the `callback` function will
+the `hostname`. The `address` argument passed to the `callback` function will
be an object with the following properties:
* `nsname`
@@ -344,6 +373,10 @@ be an object with the following properties:
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {Object[]}
Uses the DNS protocol to resolve service records (`SRV` records) for the
`hostname`. The `addresses` argument passed to the `callback` function will
@@ -367,6 +400,10 @@ be an array of objects with the following properties:
+- `hostname` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `addresses` {string[][]}
Uses the DNS protocol to resolve text queries (`TXT` records) for the
`hostname`. The `addresses` argument passed to the `callback` function is
@@ -379,13 +416,14 @@ treated separately.
+- `ip` {string}
+- `callback` {Function}
+ - `err` {Error}
+ - `hostnames` {string[]}
Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
array of hostnames.
-The `callback` function has arguments `(err, hostnames)`, where `hostnames`
-is an array of resolved hostnames for the given `ip`.
-
On error, `err` is an [`Error`][] object, where `err.code` is
one of the [DNS error codes][].
@@ -393,11 +431,12 @@ one of the [DNS error codes][].
+- `servers` {string[]}
Sets the IP addresses of the servers to be used when resolving. The `servers`
argument is an array of IPv4 or IPv6 addresses.
-If a port specified on the address it will be removed.
+If a port is specified on the address, it will be removed.
An error will be thrown if an invalid address is provided.
diff --git a/doc/api/events.md b/doc/api/events.md
index 5f12cfe3191..5c0614b68bf 100644
--- a/doc/api/events.md
+++ b/doc/api/events.md
@@ -98,7 +98,7 @@ listener will be invoked _every time_ the named event is emitted.
```js
const myEmitter = new MyEmitter();
-var m = 0;
+let m = 0;
myEmitter.on('event', () => {
console.log(++m);
});
@@ -114,7 +114,7 @@ the listener is unregistered and *then* called.
```js
const myEmitter = new MyEmitter();
-var m = 0;
+let m = 0;
myEmitter.once('event', () => {
console.log(++m);
});
@@ -148,7 +148,7 @@ can be used. (_Note, however, that the `domain` module has been deprecated_)
const myEmitter = new MyEmitter();
process.on('uncaughtException', (err) => {
- console.log('whoops! there was an error');
+ console.error('whoops! there was an error');
});
myEmitter.emit('error', new Error('whoops!'));
@@ -160,7 +160,7 @@ As a best practice, listeners should always be added for the `'error'` events.
```js
const myEmitter = new MyEmitter();
myEmitter.on('error', (err) => {
- console.log('whoops! there was an error');
+ console.error('whoops! there was an error');
});
myEmitter.emit('error', new Error('whoops!'));
// Prints: whoops! there was an error
@@ -185,7 +185,7 @@ added and `'removeListener'` when existing listeners are removed.
added: v0.1.26
-->
-* `eventName` {string|symbol} The name of the event being listened for
+* `eventName` {any} The name of the event being listened for
* `listener` {Function} The event handler function
The `EventEmitter` instance will emit its own `'newListener'` event *before*
@@ -229,7 +229,7 @@ changes:
now yields the original listener function.
-->
-* `eventName` {string|symbol} The event name
+* `eventName` {any} The event name
* `listener` {Function} The event handler function
The `'removeListener'` event is emitted *after* the `listener` is removed.
@@ -296,6 +296,8 @@ Its `name` property is set to `'MaxListenersExceededWarning'`.
+- `eventName` {any}
+- `listener` {Function}
Alias for `emitter.on(eventName, listener)`.
@@ -303,6 +305,8 @@ Alias for `emitter.on(eventName, listener)`.
+- `eventName` {any}
+- `...args` {any}
Synchronously calls each of the listeners registered for the event named
`eventName`, in the order they were registered, passing the supplied arguments
@@ -345,7 +349,7 @@ set by [`emitter.setMaxListeners(n)`][] or defaults to
added: v3.2.0
-->
-* `eventName` {string|symbol} The name of the event being listened for
+* `eventName` {any} The name of the event being listened for
Returns the number of listeners listening to the event named `eventName`.
@@ -358,6 +362,7 @@ changes:
description: For listeners attached using `.once()` this returns the
original listeners instead of wrapper functions now.
-->
+- `eventName` {any}
Returns a copy of the array of listeners for the event named `eventName`.
@@ -374,7 +379,7 @@ console.log(util.inspect(server.listeners('connection')));
added: v0.1.101
-->
-* `eventName` {string|symbol} The name of the event.
+* `eventName` {any} The name of the event.
* `listener` {Function} The callback function
Adds the `listener` function to the end of the listeners array for the
@@ -410,7 +415,7 @@ myEE.emit('foo');
added: v0.3.0
-->
-* `eventName` {string|symbol} The name of the event.
+* `eventName` {any} The name of the event.
* `listener` {Function} The callback function
Adds a **one time** `listener` function for the event named `eventName`. The
@@ -443,7 +448,7 @@ myEE.emit('foo');
added: v6.0.0
-->
-* `eventName` {string|symbol} The name of the event.
+* `eventName` {any} The name of the event.
* `listener` {Function} The callback function
Adds the `listener` function to the *beginning* of the listeners array for the
@@ -465,7 +470,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
added: v6.0.0
-->
-* `eventName` {string|symbol} The name of the event.
+* `eventName` {any} The name of the event.
* `listener` {Function} The callback function
Adds a **one time** `listener` function for the event named `eventName` to the
@@ -484,6 +489,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
+- `eventName` {any}
Removes all listeners, or those of the specified `eventName`.
@@ -497,12 +503,14 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
+- `eventName` {any}
+- `listener` {Function}
Removes the specified `listener` from the listener array for the event named
`eventName`.
```js
-var callback = (stream) => {
+const callback = (stream) => {
console.log('someone connected!');
};
server.on('connection', callback);
@@ -524,12 +532,12 @@ events will behave as expected.
```js
const myEmitter = new MyEmitter();
-var callbackA = () => {
+const callbackA = () => {
console.log('A');
myEmitter.removeListener('event', callbackB);
};
-var callbackB = () => {
+const callbackB = () => {
console.log('B');
};
@@ -564,6 +572,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
+- `n` {integer}
By default EventEmitters will print a warning if more than `10` listeners are
added for a particular event. This is a useful default that helps finding
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 973ee7ee8e0..a0c669f2095 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -161,14 +161,18 @@ LOAD_AS_FILE(X)
3. If X.json is a file, parse X.json to a JavaScript Object. STOP
4. If X.node is a file, load X.node as binary addon. STOP
+LOAD_INDEX(X)
+1. If X/index.js is a file, load X/index.js as JavaScript text. STOP
+2. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
+3. If X/index.node is a file, load X/index.node as binary addon. STOP
+
LOAD_AS_DIRECTORY(X)
1. If X/package.json is a file,
a. Parse X/package.json, and look for "main" field.
b. let M = X + (json main field)
c. LOAD_AS_FILE(M)
-2. If X/index.js is a file, load X/index.js as JavaScript text. STOP
-3. If X/index.json is a file, parse X/index.json to a JavaScript object. STOP
-4. If X/index.node is a file, load X/index.node as binary addon. STOP
+ d. LOAD_INDEX(M)
+2. LOAD_INDEX(X)
LOAD_NODE_MODULES(X, START)
1. let DIRS=NODE_MODULES_PATHS(START)
diff --git a/doc/api/net.md b/doc/api/net.md
index 67e7abfa8ed..f1df6911859 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -3,20 +3,52 @@
> Stability: 2 - Stable
The `net` module provides an asynchronous network API for creating stream-based
-servers ([`net.createServer()`][]) and clients ([`net.createConnection()`][])
-that implement TCP or local communications (domain sockets on UNIX, named pipes
-on Windows). It can be accessed using:
+TCP or [IPC][] servers ([`net.createServer()`][]) and clients
+([`net.createConnection()`][]).
+
+It can be accessed using:
```js
const net = require('net');
```
+## IPC Support
+
+The `net` module supports IPC with named pipes on Windows, and UNIX domain
+sockets on other operating systems.
+
+### Identifying paths for IPC connections
+
+[`net.connect()`][], [`net.createConnection()`][], [`server.listen()`][] and
+[`socket.connect()`][] take a `path` parameter to identify IPC endpoints.
+
+On UNIX, the local domain is also known as the UNIX domain. The path is a
+filesystem path name. It gets truncated to `sizeof(sockaddr_un.sun_path) - 1`,
+which varies on different operating system between 91 and 107 bytes.
+The typical values are 107 on Linux and 103 on OS X. The path is
+subject to the same naming conventions and permissions checks as would be done
+on file creation. It will be visible in the filesystem, and will *persist until
+unlinked*.
+
+On Windows, the local domain is implemented using a named pipe. The path *must*
+refer to an entry in `\\?\pipe\` or `\\.\pipe\`. Any characters are permitted,
+but the latter may do some processing of pipe names, such as resolving `..`
+sequences. Despite appearances, the pipe name space is flat. Pipes will *not
+persist*, they are removed when the last reference to them is closed. Do not
+forget JavaScript string escaping requires paths to be specified with
+double-backslashes, such as:
+
+```js
+net.createServer().listen(
+ path.join('\\\\?\\pipe', process.cwd(), 'myctl'));
+```
+
## Class: net.Server
-This class is used to create a TCP or local server.
+This class is used to create a TCP or [IPC][] server.
## new net.Server([options][, connectionListener])
@@ -75,7 +107,7 @@ Returns an object with `port`, `family`, and `address` properties:
Example:
```js
-var server = net.createServer((socket) => {
+const server = net.createServer((socket) => {
socket.end('goodbye\n');
}).on('error', (err) => {
// handle errors here
@@ -129,17 +161,14 @@ Callback should take two arguments `err` and `count`.
### server.listen()
Start a server listening for connections. A `net.Server` can be a TCP or
-local (domain sockets on UNIX, named pipes on Windows) server depending on
-what it listens to.
-
-*Note*: Unix named pipes (FIFOs) are not supported.
+a [IPC][] server depending on what it listens to.
Possible signatures:
* [`server.listen(handle[, backlog][, callback])`][`server.listen(handle)`]
* [`server.listen(options[, callback])`][`server.listen(options)`]
* [`server.listen(path[, backlog][, callback])`][`server.listen(path)`]
- for local servers
+ for [IPC][] servers
* [`server.listen([port][, host][, backlog][, callback])`][`server.listen(port, host)`]
for TCP servers
@@ -201,13 +230,14 @@ added: v0.11.14
-->
* `options` {Object} Required. Supports the following properties:
- * `port` {number} Optional.
- * `host` {string} Optional.
- * `path` {string} Optional. Will be ignored if `port` is specified.
- * `backlog` {number} Optional. Common parameter of [`server.listen()`][]
+ * `port` {number}
+ * `host` {string}
+ * `path` {string} Will be ignored if `port` is specified. See
+ [Identifying paths for IPC connections][].
+ * `backlog` {number} Common parameter of [`server.listen()`][]
functions
- * `exclusive` {boolean} Optional. Default to `false`
-* `callback` {Function} Optional. Common parameter of [`server.listen()`][]
+ * `exclusive` {boolean} Default to `false`
+* `callback` {Function} Common parameter of [`server.listen()`][]
functions
If `port` is specified, it behaves the same as
@@ -235,32 +265,12 @@ server.listen({
added: v0.1.90
-->
-* `path` {string}
+* `path` {String} Path the server should listen to. See
+ [Identifying paths for IPC connections][].
* `backlog` {number} Common parameter of [`server.listen()`][] functions
* `callback` {Function} Common parameter of [`server.listen()`][] functions
-Start a local socket server listening for connections on the given `path`.
-
-On UNIX, the local domain is usually known as the UNIX domain. The path is a
-filesystem path name. It gets truncated to `sizeof(sockaddr_un.sun_path)`
-bytes, decreased by 1. It varies on different operating system between 91 and
-107 bytes. The typical values are 107 on Linux and 103 on OS X. The path is
-subject to the same naming conventions and permissions checks as would be done
-on file creation, will be visible in the filesystem, and will *persist until
-unlinked*.
-
-On Windows, the local domain is implemented using a named pipe. The path *must*
-refer to an entry in `\\?\pipe\` or `\\.\pipe\`. Any characters are permitted,
-but the latter may do some processing of pipe names, such as resolving `..`
-sequences. Despite appearances, the pipe name space is flat. Pipes will *not
-persist*, they are removed when the last reference to them is closed. Do not
-forget JavaScript string escaping requires paths to be specified with
-double-backslashes, such as:
-
-```js
-net.createServer().listen(
- path.join('\\\\?\\pipe', process.cwd(), 'myctl'))
-```
+Start a [IPC][] server listening for connections on the given `path`.
#### server.listen([port][, host][, backlog][, callback])
-This object is an abstraction of a TCP or local socket. `net.Socket`
-instances implement a duplex Stream interface. They can be created by the
-user and used as a client (with [`connect()`][]) or they can be created by Node.js
-and passed to the user through the `'connection'` event of a server.
+This class is an abstraction of a TCP socket or a streaming [IPC][] endpoint
+(uses named pipes on Windows, and UNIX domain sockets otherwise). A
+`net.Socket` is also a [duplex stream][], so it can be both readable and
+writable, and it is also a [`EventEmitter`][].
+
+A `net.Socket` can be created by the user and used directly to interact with
+a server. For example, it is returned by [`net.createConnection()`][],
+so the user can use it to talk to the server.
+
+It can also be be created by Node.js and passed to the user when a connection
+is received. For example, it is passed to the listeners of a
+[`'connection'`][] event emitted on a [`net.Server`][], so the user can use
+it to interact with the client.
### new net.Socket([options])
-Construct a new socket object.
-
-`options` is an object with the following defaults:
-
-```js
-{
- fd: null,
- allowHalfOpen: false,
- readable: false,
- writable: false
-}
-```
+Creates a new socket object.
-`fd` allows you to specify the existing file descriptor of socket.
-Set `readable` and/or `writable` to `true` to allow reads and/or writes on this
-socket (NOTE: Works only when `fd` is passed).
-About `allowHalfOpen`, refer to [`net.createServer()`][] and [`'end'`][] event.
+* `options` {Object} Available options are:
+ * `fd`: {number} If specified, wrap around an existing socket with
+ the given file descriptor, otherwise a new socket will be created.
+ * `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections
+ are allowed. See [`net.createServer()`][] and the [`'end'`][] event
+ for details. Defaults to `false`.
+ * `readable` {boolean} Allow reads on the socket when a `fd` is passed,
+ otherwise ignored. Defaults to `false`.
+ * `writable` {boolean} Allow reads on the socket when a `fd` is passed,
+ otherwise ignored. Defaults to `false`.
+* Returns: {net.Socket}
-`net.Socket` instances are [`EventEmitter`][] with the following events:
+The newly created socket can be either a TCP socket or a streaming [IPC][]
+endpoint, depending on what it [`connect()`][`socket.connect()`] to.
### Event: 'close'
Emitted when a socket connection is successfully established.
-See [`connect()`][].
+See [`net.createConnection()`][].
### Event: 'data'
-Opens the connection for a given socket.
-
-For TCP sockets, `options` argument should be an object which specifies:
-
- - `port`: Port the client should connect to (Required).
-
- - `host`: Host the client should connect to. Defaults to `'localhost'`.
-
- - `localAddress`: Local interface to bind to for network connections.
+* `options` {Object}
+* `connectListener` {Function} Common parameter of [`socket.connect()`][]
+ methods. Will be added as a listener for the [`'connect'`][] event once.
+* Returns: {net.Socket} The socket itself.
- - `localPort`: Local port to bind to for network connections.
+Initiate a connection on a given socket. Normally this method is not needed,
+the socket should be created and opened with [`net.createConnection()`][]. Use
+this only if you are implementing a custom Socket.
- - `family` : Version of IP stack. Defaults to `4`.
+For TCP connections, available `options` are:
- - `hints`: [`dns.lookup()` hints][]. Defaults to `0`.
+* `port` {number} Required. Port the socket should connect to.
+* `host` {string} Host the socket should connect to. Defaults to `'localhost'`.
+* `localAddress` {string} Local address the socket should connect from.
+* `localPort` {number} Local port the socket should connect from.
+* `family` {number}: Version of IP stack, can be either 4 or 6. Defaults to 4.
+* `hints` {number} Optional [`dns.lookup()` hints][].
+* `lookup` {Function} Custom lookup function. Defaults to [`dns.lookup()`][].
- - `lookup` : Custom lookup function. Defaults to `dns.lookup`.
+For [IPC][] connections, available `options` are:
-For local domain sockets, `options` argument should be an object which
-specifies:
+* `path` {string} Required. Path the client should connect to.
+ See [Identifying paths for IPC connections][].
- - `path`: Path the client should connect to (Required).
+#### socket.connect(path[, connectListener])
-Normally this method is not needed, as `net.createConnection` opens the
-socket. Use this only if you are implementing a custom Socket.
+* `path` {string} Path the client should connect to. See
+ [Identifying paths for IPC connections][].
+* `connectListener` {Function} Common parameter of [`socket.connect()`][]
+ methods. Will be added as a listener for the [`'connect'`][] event once.
+* Returns: {net.Socket} The socket itself.
-This function is asynchronous. When the [`'connect'`][] event is emitted the
-socket is established. If there is a problem connecting, the `'connect'` event
-will not be emitted, the [`'error'`][] event will be emitted with the exception.
+Initiate an [IPC][] connection on the given socket.
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event.
+Alias to
+[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
+called with `{ path: path }` as `options`.
-### socket.connect(path[, connectListener])
-### socket.connect(port[, host][, connectListener])
+#### socket.connect(port[, host][, connectListener])
-As [`socket.connect(options[, connectListener])`][`socket.connect(options, connectListener)`],
-with options as either `{port: port, host: host}` or `{path: path}`.
+* `port` {number} Port the client should connect to.
+* `host` {string} Host the client should connect to.
+* `connectListener` {Function} Common parameter of [`socket.connect()`][]
+ methods. Will be added as a listener for the [`'connect'`][] event once.
+* Returns: {net.Socket} The socket itself.
+
+Initiate a TCP connection on the given socket.
+
+Alias to
+[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
+called with `{port: port, host: host}` as `options`.
### socket.connecting
-If `true` - [`socket.connect(options[, connectListener])`][`socket.connect(options, connectListener)`] was called and
-haven't yet finished. Will be set to `false` before emitting `connect` event
-and/or calling [`socket.connect(options[, connectListener])`][`socket.connect(options, connectListener)`]'s callback.
+If `true` -
+[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
+was called and haven't yet finished. Will be set to `false` before emitting
+`connect` event and/or calling
+[`socket.connect(options[, connectListener])`][`socket.connect(options)`]'s
+callback.
### socket.destroy([exception])
+## net.connect()
-A factory function, which returns a new [`net.Socket`][] and automatically
-connects with the supplied `options`.
+Aliases to
+[`net.createConnection()`][`net.createConnection()`].
-The options are passed to both the [`net.Socket`][] constructor and the
-[`socket.connect`][] method.
-
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
-
-Here is an example of a client of the previously described echo server:
-
-```js
-const net = require('net');
-const client = net.connect({port: 8124}, () => {
- // 'connect' listener
- console.log('connected to server!');
- client.write('world!\r\n');
-});
-client.on('data', (data) => {
- console.log(data.toString());
- client.end();
-});
-client.on('end', () => {
- console.log('disconnected from server');
-});
-```
+Possible signatures:
-To connect on the socket `/tmp/echo.sock` the second line would just be
-changed to
+* [`net.connect(options[, connectListener])`][`net.connect(options)`]
+* [`net.connect(path[, connectListener])`][`net.connect(path)`] for [IPC][]
+ connections.
+* [`net.connect(port[, host][, connectListener])`][`net.connect(port, host)`]
+ for TCP connections.
-```js
-const client = net.connect({path: '/tmp/echo.sock'});
-```
+### net.connect(options[, connectListener])
+
+Alias to
+[`net.createConnection(options[, connectListener])`][`net.createConnection(options)`].
-## net.connect(path[, connectListener])
+### net.connect(path[, connectListener])
-A factory function, which returns a new unix [`net.Socket`][] and automatically
-connects to the supplied `path`.
+Alias to
+[`net.createConnection(path[, connectListener])`][`net.createConnection(path)`].
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
-
-## net.connect(port[, host][, connectListener])
+### net.connect(port[, host][, connectListener])
-A factory function, which returns a new [`net.Socket`][] and automatically
-connects to the supplied `port` and `host`.
+Alias to
+[`net.createConnection(port[, host][, connectListener])`][`net.createConnection(port, host)`].
+
+## net.createConnection()
-If `host` is omitted, `'localhost'` will be assumed.
+A factory function, which creates a new [`net.Socket`][],
+immediately initiates connection with [`socket.connect()`][],
+then returns the `net.Socket` that starts the connection.
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
+When the connection is established, a [`'connect'`][] event will be emitted
+on the returned socket. The last parameter `connectListener`, if supplied,
+will be added as a listener for the [`'connect'`][] event **once**.
-## net.createConnection(options[, connectListener])
+Possible signatures:
+
+* [`net.createConnection(options[, connectListener])`][`net.createConnection(options)`]
+* [`net.createConnection(path[, connectListener])`][`net.createConnection(path)`]
+ for [IPC][] connections.
+* [`net.createConnection(port[, host][, connectListener])`][`net.createConnection(port, host)`]
+ for TCP connections.
+
+*Note*: the [`net.connect()`][] function is an alias to this function.
+
+### net.createConnection(options[, connectListener])
-A factory function, which returns a new [`net.Socket`][] and automatically
-connects with the supplied `options`.
+* `options` {Object} Required. Will be passed to both the
+ [`new net.Socket([options])`][`new net.Socket(options)`] call and the
+ [`socket.connect(options[, connectListener])`][`socket.connect(options)`]
+ method.
+* `connectListener` {Function} Common parameter of the
+ [`net.createConnection()`][] functions. If supplied, will be added as
+ a listener for the [`'connect'`][] event on the returned socket once.
+* Returns: {net.Socket} The newly created socket used to start the connection.
-The options are passed to both the [`net.Socket`][] constructor and the
-[`socket.connect`][] method.
+For available options, see
+[`new net.Socket([options])`][`new net.Socket(options)`]
+and [`socket.connect(options[, connectListener])`][`socket.connect(options)`].
-Passing `timeout` as an option will call [`socket.setTimeout()`][] after the socket is created, but before it is connecting.
+Additional options:
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
+* `timeout` {number} If set, will be used to call
+ [`socket.setTimeout(timeout)`][] after the socket is created, but before
+ it starts the connection.
Here is an example of a client of the previously described echo server:
@@ -844,39 +896,59 @@ To connect on the socket `/tmp/echo.sock` the second line would just be
changed to
```js
-const client = net.connect({path: '/tmp/echo.sock'});
+const client = net.createConnection({path: '/tmp/echo.sock'});
```
-## net.createConnection(path[, connectListener])
+### net.createConnection(path[, connectListener])
-A factory function, which returns a new unix [`net.Socket`][] and automatically
-connects to the supplied `path`.
+* `path` {string} Path the socket should connect to. Will be passed to
+ [`socket.connect(path[, connectListener])`][`socket.connect(path)`].
+ See [Identifying paths for IPC connections][].
+* `connectListener` {Function} Common parameter of the
+ [`net.createConnection()`][] functions, an "once" listener for the
+ `'connect'` event on the initiating socket. Will be passed to
+ [`socket.connect(path[, connectListener])`][`socket.connect(path)`].
+* Returns: {net.Socket} The newly created socket used to start the connection.
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
+Initiates an [IPC][] connection.
-## net.createConnection(port[, host][, connectListener])
+This function creates a new [`net.Socket`][] with all options set to default,
+immediately initiates connection with
+[`socket.connect(path[, connectListener])`][`socket.connect(path)`],
+then returns the `net.Socket` that starts the connection.
+
+### net.createConnection(port[, host][, connectListener])
-A factory function, which returns a new [`net.Socket`][] and automatically
-connects to the supplied `port` and `host`.
+* `port` {number} Port the socket should connect to. Will be passed to
+ [`socket.connect(port[, host][, connectListener])`][`socket.connect(port, host)`].
+* `host` {string} Host the socket should connect to. Defaults to `'localhost'`.
+ Will be passed to
+ [`socket.connect(port[, host][, connectListener])`][`socket.connect(port, host)`].
+* `connectListener` {Function} Common parameter of the
+ [`net.createConnection()`][] functions, an "once" listener for the
+ `'connect'` event on the initiating socket. Will be passed to
+ [`socket.connect(path[, connectListener])`][`socket.connect(port, host)`].
+* Returns: {net.Socket} The newly created socket used to start the connection.
-If `host` is omitted, `'localhost'` will be assumed.
+Initiates a TCP connection.
-The `connectListener` parameter will be added as a listener for the
-[`'connect'`][] event once.
+This function creates a new [`net.Socket`][] with all options set to default,
+immediately initiates connection with
+[`socket.connect(port[, host][, connectListener])`][`socket.connect(port, host)`],
+then returns the `net.Socket` that starts the connection.
## net.createServer([options][, connectionListener])
-Creates a new TCP or local server.
+Creates a new TCP or [IPC][] server.
* `options` {Object}
* `allowHalfOpen` {boolean} Default to `false`. Indicates whether half-opened
@@ -898,7 +970,7 @@ This allows connections to be passed between processes without any data being
read by the original process. To begin reading data from a paused socket, call
[`socket.resume()`][].
-The server can be a TCP server or a local server, depending on what it
+The server can be a TCP server or a [IPC][] server, depending on what it
[`listen()`][`server.listen()`] to.
Here is an example of an TCP echo server which listens for connections
@@ -925,8 +997,8 @@ server.listen(8124, () => {
Test this by using `telnet`:
-```sh
-telnet localhost 8124
+```console
+$ telnet localhost 8124
```
To listen on the socket `/tmp/echo.sock` the third line from the last would
@@ -940,8 +1012,8 @@ server.listen('/tmp/echo.sock', () => {
Use `nc` to connect to a UNIX domain socket server:
-```js
-nc -U /tmp/echo.sock
+```console
+$ nc -U /tmp/echo.sock
```
## net.isIP(input)
@@ -978,14 +1050,22 @@ Returns true if input is a version 6 IP address, otherwise returns false.
[`'listening'`]: #net_event_listening
[`'timeout'`]: #net_event_timeout
[`child_process.fork()`]: child_process.html#child_process_child_process_fork_modulepath_args_options
-[`connect()`]: #net_socket_connect_options_connectlistener
[`dns.lookup()`]: dns.html#dns_dns_lookup_hostname_options_callback
[`dns.lookup()` hints]: dns.html#dns_supported_getaddrinfo_flags
[`EventEmitter`]: events.html#events_class_eventemitter
-[`net.createConnection()`]: #net_net_createconnection_options_connectlistener
+[`net.connect()`]: #net_net_connect
+[`net.connect(options)`]: #net_net_connect_options_connectlistener
+[`net.connect(path)`]: #net_net_connect_path_connectlistener
+[`net.connect(port, host)`]: #net_net_connect_port_host_connectlistener
+[`net.connect()`]: #net_net_connect
+[`net.createConnection()`]: #net_net_createconnection
+[`net.createConnection(options)`]: #net_net_createconnection_options_connectlistener
+[`net.createConnection(path)`]: #net_net_createconnection_path_connectlistener
+[`net.createConnection(port, host)`]: #net_net_createconnection_port_host_connectlistener
[`net.createServer()`]: #net_net_createserver_options_connectionlistener
[`net.Server`]: #net_class_net_server
[`net.Socket`]: #net_class_net_socket
+[`new net.Socket(options)`]: #net_new_net_socket_options
[`server.getConnections()`]: #net_server_getconnections_callback
[`server.listen()`]: #net_server_listen
[`server.listen(handle)`]: #net_server_listen_handle_backlog_callback
@@ -993,15 +1073,21 @@ Returns true if input is a version 6 IP address, otherwise returns false.
[`server.listen(path)`]: #net_server_listen_path_backlog_callback
[`server.listen(port, host)`]: #net_server_listen_port_host_backlog_callback
[`server.close()`]: #net_server_close_callback
-[`socket.connect(options, connectListener)`]: #net_socket_connect_options_connectlistener
-[`socket.connect`]: #net_socket_connect_options_connectlistener
+[`socket.connect()`]: #net_socket_connect
+[`socket.connect(options)`]: #net_socket_connect_options_connectlistener
+[`socket.connect(path)`]: #net_socket_connect_path_connectlistener
+[`socket.connect(port, host)`]: #net_socket_connect_port_host_connectlistener
[`socket.destroy()`]: #net_socket_destroy_exception
[`socket.end()`]: #net_socket_end_data_encoding
[`socket.setTimeout()`]: #net_socket_settimeout_timeout_callback
+[`socket.setTimeout(timeout)`]: #net_socket_settimeout_timeout_callback
[`socket.resume()`]: #net_socket_resume
[`socket.pause()`]: #net_socket_pause
[`stream.setEncoding()`]: stream.html#stream_readable_setencoding_encoding
+[duplex stream]: stream.html#stream_class_stream_duplex
[half-closed]: https://tools.ietf.org/html/rfc1122#section-4.2.2.13
+[Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections
+[IPC]: #net_ipc_support
[Readable Stream]: stream.html#stream_class_stream_readable
[socket(7)]: http://man7.org/linux/man-pages/man7/socket.7.html
[unspecified IPv6 address]: https://en.wikipedia.org/wiki/IPv6_address#Unspecified_address
diff --git a/doc/api/process.md b/doc/api/process.md
index bc9dc7919d6..2e9b655f28c 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -298,7 +298,7 @@ too many listeners have been added to an event
```txt
$ node
-> event.defaultMaxListeners = 1;
+> events.defaultMaxListeners = 1;
> process.on('foo', () => {});
> process.on('foo', () => {});
> (node:38638) Warning: Possible EventEmitter memory leak detected. 2 foo
@@ -311,7 +311,7 @@ adds a custom handler to the `'warning'` event:
```txt
$ node --no-warnings
> var p = process.on('warning', (warning) => console.warn('Do not do that!'));
-> event.defaultMaxListeners = 1;
+> events.defaultMaxListeners = 1;
> process.on('foo', () => {});
> process.on('foo', () => {});
> Do not do that!
@@ -1774,6 +1774,8 @@ cases:
[`Error`]: errors.html#errors_class_error
[`EventEmitter`]: events.html#events_class_eventemitter
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
+[`console.error()`]: console.html#console_console_error_data_args
+[`console.log()`]: console.html#console_console_log_data_args
[`net.Server`]: net.html#net_class_net_server
[`net.Socket`]: net.html#net_class_net_socket
[`process.argv`]: #process_process_argv
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 50f41a33db1..75cba6fd514 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -480,7 +480,7 @@ If the data to be written can be generated or fetched on demand, it is
recommended to encapsulate the logic into a [Readable][] and use
[`stream.pipe()`][]. However, if calling `write()` is preferred, it is
possible to respect backpressure and avoid memory issues using the
-the [`'drain'`][] event:
+[`'drain'`][] event:
```js
function write (data, cb) {
@@ -1016,7 +1016,7 @@ function parseHeader(stream, callback) {
const remaining = split.join('\n\n');
const buf = Buffer.from(remaining, 'utf8');
stream.removeListener('error', callback);
- // set the readable listener before unshifting
+ // remove the readable listener before unshifting
stream.removeListener('readable', onReadable);
if (buf.length)
stream.unshift(buf);
diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css
index 7889389f59b..20845970fbc 100644
--- a/doc/api_assets/style.css
+++ b/doc/api_assets/style.css
@@ -487,7 +487,7 @@ th > *:last-child, td > *:last-child {
@media only screen and (max-width: 1024px) {
#content {
- font-size: 2.5em;
+ font-size: 1.6em;
overflow: visible;
}
#column1.interior {
diff --git a/doc/changelogs/CHANGELOG_V7.md b/doc/changelogs/CHANGELOG_V7.md
index 53c6b345ba4..45dda5d2edd 100644
--- a/doc/changelogs/CHANGELOG_V7.md
+++ b/doc/changelogs/CHANGELOG_V7.md
@@ -6,6 +6,8 @@
|