Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ If the graceful disconnect behavior is not needed, use `worker.process.kill()`.

Causes `.exitedAfterDisconnect` to be set.

This method is aliased as `worker.destroy()` for backwards compatibility.
This method is aliased as `worker.destroy()` for backward compatibility.

In a worker, `process.kill()` exists, but it is not this function;
it is [`kill()`][].
Expand Down
2 changes: 1 addition & 1 deletion doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ The default encoding to use for functions that can take either strings
or [buffers][`Buffer`]. The default value is `'buffer'`, which makes methods
default to [`Buffer`][] objects.

The `crypto.DEFAULT_ENCODING` mechanism is provided for backwards compatibility
The `crypto.DEFAULT_ENCODING` mechanism is provided for backward compatibility
with legacy programs that expect `'latin1'` to be the default encoding.

New applications should expect the default to be `'buffer'`.
Expand Down
18 changes: 9 additions & 9 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,25 +520,25 @@ client.connect(41234, 'localhost', (err) => {

#### Note about UDP datagram size

The maximum size of an `IPv4/v6` datagram depends on the `MTU`
(_Maximum Transmission Unit_) and on the `Payload Length` field size.
The maximum size of an IPv4/v6 datagram depends on the `MTU`
(Maximum Transmission Unit) and on the `Payload Length` field size.

* The `Payload Length` field is `16 bits` wide, which means that a normal
payload cannot exceed 64K octets _including_ the internet header and data
* The `Payload Length` field is 16 bits wide, which means that a normal
payload cannot exceed 64K octets including the internet header and data
(65,507 bytes = 65,535 − 8 bytes UDP header − 20 bytes IP header);
this is generally true for loopback interfaces, but such long datagram
messages are impractical for most hosts and networks.

* The `MTU` is the largest size a given link layer technology can support for
datagram messages. For any link, `IPv4` mandates a minimum `MTU` of `68`
octets, while the recommended `MTU` for IPv4 is `576` (typically recommended
datagram messages. For any link, IPv4 mandates a minimum `MTU` of 68
octets, while the recommended `MTU` for IPv4 is 576 (typically recommended
as the `MTU` for dial-up type applications), whether they arrive whole or in
fragments.

For `IPv6`, the minimum `MTU` is `1280` octets, however, the mandatory minimum
fragment reassembly buffer size is `1500` octets. The value of `68` octets is
For IPv6, the minimum `MTU` is 1280 octets. However, the mandatory minimum
fragment reassembly buffer size is 1500 octets. The value of 68 octets is
very small, since most current link layer technologies, like Ethernet, have a
minimum `MTU` of `1500`.
minimum `MTU` of 1500.

It is impossible to know in advance the MTU of each link through which
a packet might travel. Sending a datagram greater than the receiver `MTU` will
Expand Down
8 changes: 4 additions & 4 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3792,10 +3792,10 @@ They can be one or more of the following bitflags:
* `napi_static`: The property will be defined as a static property on a class as
opposed to an instance property, which is the default. This is used only by
[`napi_define_class`][]. It is ignored by `napi_define_properties`.
* `napi_default_method`: The property is configureable, writeable but not
enumerable like a method in a JS class.
* `napi_default_property`: The property is writable, enumerable and configurable
like a property set via JS code `obj.key = value`.
* `napi_default_method`: Like a method in a JS class, the property is
configurable and writeable, but not enumerable.
* `napi_default_property`: Like a property set via assignment in JavaScript, the
property is writable, enumerable, and configurable.

#### napi_property_descriptor

Expand Down
2 changes: 1 addition & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ important ways:
* Pipes (and sockets): *synchronous* on Windows, *asynchronous* on POSIX

These behaviors are partly for historical reasons, as changing them would
create backwards incompatibility, but they are also expected by some users.
create backward incompatibility, but they are also expected by some users.

Synchronous writes avoid problems such as output written with `console.log()` or
`console.error()` being unexpectedly interleaved, or not written at all if
Expand Down
2 changes: 1 addition & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ const { createInterface } = require('readline');
<tr>
<td><code>ctrl</code> + <code>w</code> or <code>ctrl</code>
+ <code>backspace</code></td>
<td>Delete backwards to a word boundary</td>
<td>Delete backward to a word boundary</td>
<td><code>ctrl</code> + <code>backspace</code> Doesn't
work on Linux, Mac and Windows</td>
</tr>
Expand Down
10 changes: 5 additions & 5 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ added:
-->

The REPL supports bi-directional reverse-i-search similar to [ZSH][]. It is
triggered with `<ctrl> + R` to search backwards and `<ctrl> + S` to search
forwards.
triggered with `<ctrl> + R` to search backward and `<ctrl> + S` to search
forward.

Duplicated history entires will be skipped.

Expand Down Expand Up @@ -748,18 +748,18 @@ a `net.Server` and `net.Socket` instance, see:
For an example of running a REPL instance over [`curl(1)`][], see:
<https://gist.github.com/TooTallNate/2053342>.

[TTY keybindings]: readline.html#readline_tty_keybindings
[ZSH]: https://en.wikipedia.org/wiki/Z_shell
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`--experimental-repl-await`]: cli.html#cli_experimental_repl_await
[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture
[`ERR_INVALID_REPL_INPUT`]: errors.html#errors_err_invalid_repl_input
[`curl(1)`]: https://curl.haxx.se/docs/manpage.html
[`domain`]: domain.html
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
[`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function
[`repl.ReplServer`]: #repl_class_replserver
[`repl.start()`]: #repl_repl_start_options
[`util.inspect()`]: util.html#util_util_inspect_object_options
[`reverse-i-search`]: #repl_reverse_i_search
[TTY keybindings]: readline.html#readline_tty_keybindings
[`curl(1)`]: https://curl.haxx.se/docs/manpage.html
[`util.inspect()`]: util.html#util_util_inspect_object_options
[stream]: stream.html
10 changes: 5 additions & 5 deletions doc/guides/doc-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ this guide.
* Check changes to documentation with `make lint-md`.
* [Use US spelling][].
* [Use serial commas][].
* Avoid personal pronouns (_I_, _you_, _we_) in reference documentation.
* Personal pronouns are acceptable in colloquial documentation such as guides.
* Use gender-neutral pronouns and gender-neutral plural nouns.
* OK: _they_, _their_, _them_, _folks_, _people_, _developers_
* NOT OK: _his_, _hers_, _him_, _her_, _guys_, _dudes_
* Avoid first-person pronouns (_I_, _we_).
* Exception: _we recommend foo_ is preferable to _foo is recommended_.
* Use gender-neutral pronouns and gender-neutral plural nouns.
* OK: _they_, _their_, _them_, _folks_, _people_, _developers_
* NOT OK: _his_, _hers_, _him_, _her_, _guys_, _dudes_
* When combining wrapping elements (parentheses and quotes), place terminal
punctuation:
* Inside the wrapping element if the wrapping element contains a complete
Expand Down
7 changes: 3 additions & 4 deletions doc/guides/technical-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ with Node.js. Some key elements of this include:
* Enabling/supporting external packages to ensure overall developer experience

### 2 - Stability
Whenever possible, we seek to insure that currently-working code continues to
work. We seek to keep the trust of developers and end-users. Therefore, we value
stability.
Whenever possible, we seek to ensure that working code continues to work. To
keep the trust of developers and users, we value stability.
Some key elements of this include:
* Backwards compatibility
* Backward compatibility
* Stable releases on a predictable schedule
* A strong safety net, including testing how changes
in Node.js affect popular packages
Expand Down
106 changes: 2 additions & 104 deletions lib/_stream_duplex.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,6 @@
// 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 prototype inheritance, this class
// prototypically inherits from Readable, and then parasitically from
// Writable.

'use strict';

const {
ObjectDefineProperties,
ObjectGetOwnPropertyDescriptor,
ObjectKeys,
ObjectSetPrototypeOf,
} = primordials;
// TODO(mcollina): deprecate this file

const Duplex = require('internal/streams/duplex');
module.exports = Duplex;

const Readable = require('_stream_readable');
const Writable = require('_stream_writable');

ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype);
ObjectSetPrototypeOf(Duplex, Readable);

{
// Allow the keys array to be GC'ed.
for (const method of ObjectKeys(Writable.prototype)) {
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
}

function Duplex(options) {
if (!(this instanceof Duplex))
return new Duplex(options);

Readable.call(this, options);
Writable.call(this, options);
this.allowHalfOpen = true;

if (options) {
if (options.readable === false)
this.readable = false;

if (options.writable === false)
this.writable = false;

if (options.allowHalfOpen === false) {
this.allowHalfOpen = false;
}
}
}

ObjectDefineProperties(Duplex.prototype, {
writable:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable'),
writableHighWaterMark:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark'),
writableObjectMode:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode'),
writableBuffer:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer'),
writableLength:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength'),
writableFinished:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished'),
writableCorked:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked'),
writableEnded:
ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded'),

destroyed: {
get() {
if (this._readableState === undefined ||
this._writableState === undefined) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
},
set(value) {
// Backward compatibility, the user is explicitly
// managing destroyed.
if (this._readableState && this._writableState) {
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
}
}
});
45 changes: 2 additions & 43 deletions lib/_stream_passthrough.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
// 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.

'use strict';

const {
ObjectSetPrototypeOf,
} = primordials;
// TODO(mcollina): deprecate this file

const PassThrough = require('internal/streams/passthrough');
module.exports = PassThrough;

const Transform = require('_stream_transform');
ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype);
ObjectSetPrototypeOf(PassThrough, Transform);

function PassThrough(options) {
if (!(this instanceof PassThrough))
return new PassThrough(options);

Transform.call(this, options);
}

PassThrough.prototype._transform = function(chunk, encoding, cb) {
cb(null, chunk);
};
Loading