Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit ae9a06b

Browse files
committed
meta: merge node/master into node-chakracore/master
Merge 22b6804 as of 2018-03-12 This commit was automatically generated. For any problems, please contact jackhorton Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
2 parents 4adb21c + 22b6804 commit ae9a06b

22 files changed

+101
-163
lines changed

doc/api/buffer.md

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ resized.
2323
The `Buffer` class is a global within Node.js, making it unlikely that one
2424
would need to ever use `require('buffer').Buffer`.
2525

26-
Examples:
27-
2826
```js
2927
// Creates a zero-filled Buffer of length 10.
3028
const buf1 = Buffer.alloc(10);
@@ -485,8 +483,6 @@ changes:
485483
Creates a new `Buffer` containing the given JavaScript string `string`. If
486484
provided, the `encoding` parameter identifies the character encoding of `string`.
487485

488-
Examples:
489-
490486
```js
491487
const buf1 = new Buffer('this is a tést');
492488
const buf2 = new Buffer('7468697320697320612074c3a97374', 'hex');
@@ -895,8 +891,6 @@ added: v5.10.0
895891
Creates a new `Buffer` containing the given JavaScript string `string`. If
896892
provided, the `encoding` parameter identifies the character encoding of `string`.
897893

898-
Examples:
899-
900894
```js
901895
const buf1 = Buffer.from('this is a tést');
902896
const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
@@ -1048,8 +1042,6 @@ Comparison is based on the actual sequence of bytes in each `Buffer`.
10481042
* `1` is returned if `target` should come *before* `buf` when sorted.
10491043
* `-1` is returned if `target` should come *after* `buf` when sorted.
10501044

1051-
Examples:
1052-
10531045
```js
10541046
const buf1 = Buffer.from('ABC');
10551047
const buf2 = Buffer.from('BCD');
@@ -1074,8 +1066,6 @@ The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`
10741066
arguments can be used to limit the comparison to specific ranges within `target`
10751067
and `buf` respectively.
10761068

1077-
Examples:
1078-
10791069
```js
10801070
const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
10811071
const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
@@ -1185,8 +1175,6 @@ changes:
11851175
Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,
11861176
`false` otherwise.
11871177

1188-
Examples:
1189-
11901178
```js
11911179
const buf1 = Buffer.from('ABC');
11921180
const buf2 = Buffer.from('414243', 'hex');
@@ -1277,8 +1265,6 @@ added: v5.3.0
12771265

12781266
Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`].
12791267

1280-
Examples:
1281-
12821268
```js
12831269
const buf = Buffer.from('this is a buffer');
12841270

@@ -1327,8 +1313,6 @@ If `value` is:
13271313
* a number, `value` will be interpreted as an unsigned 8-bit integer
13281314
value between `0` and `255`.
13291315

1330-
Examples:
1331-
13321316
```js
13331317
const buf = Buffer.from('this is a buffer');
13341318

@@ -1427,8 +1411,6 @@ changes:
14271411
Identical to [`buf.indexOf()`], except `buf` is searched from back to front
14281412
instead of front to back.
14291413

1430-
Examples:
1431-
14321414
```js
14331415
const buf = Buffer.from('this buffer is a buffer');
14341416

@@ -1513,8 +1495,6 @@ can result in undefined and inconsistent behavior. Applications that wish to
15131495
modify the length of a `Buffer` should therefore treat `length` as read-only and
15141496
use [`buf.slice()`] to create a new `Buffer`.
15151497

1516-
Examples:
1517-
15181498
```js
15191499
let buf = Buffer.allocUnsafe(10);
15201500

@@ -1556,8 +1536,6 @@ Reads a 64-bit double from `buf` at the specified `offset` with specified
15561536
endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns
15571537
little endian).
15581538

1559-
Examples:
1560-
15611539
```js
15621540
const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
15631541

@@ -1590,8 +1568,6 @@ Reads a 32-bit float from `buf` at the specified `offset` with specified
15901568
endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns
15911569
little endian).
15921570

1593-
Examples:
1594-
15951571
```js
15961572
const buf = Buffer.from([1, 2, 3, 4]);
15971573

@@ -1623,8 +1599,6 @@ Reads a signed 8-bit integer from `buf` at the specified `offset`.
16231599

16241600
Integers read from a `Buffer` are interpreted as two's complement signed values.
16251601

1626-
Examples:
1627-
16281602
```js
16291603
const buf = Buffer.from([-1, 5]);
16301604

@@ -1656,8 +1630,6 @@ the specified endian format (`readInt16BE()` returns big endian,
16561630

16571631
Integers read from a `Buffer` are interpreted as two's complement signed values.
16581632

1659-
Examples:
1660-
16611633
```js
16621634
const buf = Buffer.from([0, 5]);
16631635

@@ -1689,8 +1661,6 @@ the specified endian format (`readInt32BE()` returns big endian,
16891661

16901662
Integers read from a `Buffer` are interpreted as two's complement signed values.
16911663

1692-
Examples:
1693-
16941664
```js
16951665
const buf = Buffer.from([0, 0, 0, 5]);
16961666

@@ -1721,8 +1691,6 @@ Reads `byteLength` number of bytes from `buf` at the specified `offset`
17211691
and interprets the result as a two's complement signed value. Supports up to 48
17221692
bits of accuracy.
17231693

1724-
Examples:
1725-
17261694
```js
17271695
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
17281696

@@ -1751,8 +1719,6 @@ changes:
17511719

17521720
Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
17531721

1754-
Examples:
1755-
17561722
```js
17571723
const buf = Buffer.from([1, -2]);
17581724

@@ -1782,8 +1748,6 @@ Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
17821748
specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()`
17831749
returns little endian).
17841750

1785-
Examples:
1786-
17871751
```js
17881752
const buf = Buffer.from([0x12, 0x34, 0x56]);
17891753

@@ -1817,8 +1781,6 @@ Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
18171781
specified endian format (`readUInt32BE()` returns big endian,
18181782
`readUInt32LE()` returns little endian).
18191783

1820-
Examples:
1821-
18221784
```js
18231785
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
18241786

@@ -1849,8 +1811,6 @@ Reads `byteLength` number of bytes from `buf` at the specified `offset`
18491811
and interprets the result as an unsigned integer. Supports up to 48
18501812
bits of accuracy.
18511813

1852-
Examples:
1853-
18541814
```js
18551815
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
18561816

@@ -1915,8 +1875,6 @@ console.log(buf2.toString('ascii', 0, buf2.length));
19151875
Specifying negative indexes causes the slice to be generated relative to the
19161876
end of `buf` rather than the beginning.
19171877

1918-
Examples:
1919-
19201878
```js
19211879
const buf = Buffer.from('buffer');
19221880

@@ -1943,8 +1901,6 @@ added: v5.10.0
19431901
Interprets `buf` as an array of unsigned 16-bit integers and swaps the byte-order
19441902
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 2.
19451903

1946-
Examples:
1947-
19481904
```js
19491905
const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
19501906

@@ -1972,8 +1928,6 @@ added: v5.10.0
19721928
Interprets `buf` as an array of unsigned 32-bit integers and swaps the byte-order
19731929
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 4.
19741930

1975-
Examples:
1976-
19771931
```js
19781932
const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
19791933

@@ -2001,8 +1955,6 @@ added: v6.3.0
20011955
Interprets `buf` as an array of 64-bit numbers and swaps the byte-order *in-place*.
20021956
Throws a `RangeError` if [`buf.length`] is not a multiple of 8.
20031957

2004-
Examples:
2005-
20061958
```js
20071959
const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
20081960

@@ -2069,8 +2021,6 @@ Decodes `buf` to a string according to the specified character encoding in
20692021
The maximum length of a string instance (in UTF-16 code units) is available
20702022
as [`buffer.constants.MAX_STRING_LENGTH`][].
20712023

2072-
Examples:
2073-
20742024
```js
20752025
const buf1 = Buffer.allocUnsafe(26);
20762026

@@ -2104,8 +2054,6 @@ added: v1.1.0
21042054
Creates and returns an [iterator] for `buf` values (bytes). This function is
21052055
called automatically when a `Buffer` is used in a `for..of` statement.
21062056

2107-
Examples:
2108-
21092057
```js
21102058
const buf = Buffer.from('buffer');
21112059

@@ -2179,8 +2127,6 @@ format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
21792127
endian). `value` *should* be a valid 64-bit double. Behavior is undefined when
21802128
`value` is anything other than a 64-bit double.
21812129

2182-
Examples:
2183-
21842130
```js
21852131
const buf = Buffer.allocUnsafe(8);
21862132

@@ -2215,8 +2161,6 @@ format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
22152161
endian). `value` *should* be a valid 32-bit float. Behavior is undefined when
22162162
`value` is anything other than a 32-bit float.
22172163

2218-
Examples:
2219-
22202164
```js
22212165
const buf = Buffer.allocUnsafe(4);
22222166

@@ -2251,8 +2195,6 @@ a signed 8-bit integer.
22512195

22522196
`value` is interpreted and written as a two's complement signed integer.
22532197

2254-
Examples:
2255-
22562198
```js
22572199
const buf = Buffer.allocUnsafe(2);
22582200

@@ -2285,8 +2227,6 @@ when `value` is anything other than a signed 16-bit integer.
22852227

22862228
`value` is interpreted and written as a two's complement signed integer.
22872229

2288-
Examples:
2289-
22902230
```js
22912231
const buf = Buffer.allocUnsafe(4);
22922232

@@ -2319,8 +2259,6 @@ when `value` is anything other than a signed 32-bit integer.
23192259

23202260
`value` is interpreted and written as a two's complement signed integer.
23212261

2322-
Examples:
2323-
23242262
```js
23252263
const buf = Buffer.allocUnsafe(8);
23262264

@@ -2351,8 +2289,6 @@ Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
23512289
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
23522290
anything other than a signed integer.
23532291

2354-
Examples:
2355-
23562292
```js
23572293
const buf = Buffer.allocUnsafe(6);
23582294

@@ -2385,8 +2321,6 @@ Writes `value` to `buf` at the specified `offset`. `value` *should* be a
23852321
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
23862322
other than an unsigned 8-bit integer.
23872323

2388-
Examples:
2389-
23902324
```js
23912325
const buf = Buffer.allocUnsafe(4);
23922326

@@ -2419,8 +2353,6 @@ format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
24192353
endian). `value` should be a valid unsigned 16-bit integer. Behavior is
24202354
undefined when `value` is anything other than an unsigned 16-bit integer.
24212355

2422-
Examples:
2423-
24242356
```js
24252357
const buf = Buffer.allocUnsafe(4);
24262358

@@ -2457,8 +2389,6 @@ format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
24572389
endian). `value` should be a valid unsigned 32-bit integer. Behavior is
24582390
undefined when `value` is anything other than an unsigned 32-bit integer.
24592391

2460-
Examples:
2461-
24622392
```js
24632393
const buf = Buffer.allocUnsafe(4);
24642394

@@ -2494,8 +2424,6 @@ Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
24942424
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
24952425
anything other than an unsigned integer.
24962426

2497-
Examples:
2498-
24992427
```js
25002428
const buf = Buffer.allocUnsafe(6);
25012429

lib/_http_outgoing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ OutgoingMessage.prototype.removeHeader = function removeHeader(name) {
616616

617617

618618
OutgoingMessage.prototype._implicitHeader = function _implicitHeader() {
619-
throw new ERR_METHOD_NOT_IMPLEMENTED('_implicitHeader()');
619+
this.emit('error', new ERR_METHOD_NOT_IMPLEMENTED('_implicitHeader()'));
620620
};
621621

622622
Object.defineProperty(OutgoingMessage.prototype, 'headersSent', {

lib/_stream_readable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const { getHighWaterMark } = require('internal/streams/state');
3535
const {
3636
ERR_INVALID_ARG_TYPE,
3737
ERR_STREAM_PUSH_AFTER_EOF,
38-
ERR_STREAM_READ_NOT_IMPLEMENTED,
38+
ERR_METHOD_NOT_IMPLEMENTED,
3939
ERR_STREAM_UNSHIFT_AFTER_END_EVENT
4040
} = require('internal/errors').codes;
4141
const ReadableAsyncIterator = require('internal/streams/async_iterator');
@@ -568,7 +568,7 @@ function maybeReadMore_(stream, state) {
568568
// for virtual (non-string, non-buffer) streams, "length" is somewhat
569569
// arbitrary, and perhaps not very meaningful.
570570
Readable.prototype._read = function(n) {
571-
this.emit('error', new ERR_STREAM_READ_NOT_IMPLEMENTED());
571+
this.emit('error', new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
572572
};
573573

574574
Readable.prototype.pipe = function(dest, pipeOpts) {

lib/_stream_transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Transform.prototype.push = function(chunk, encoding) {
162162
// an error, then that'll put the hurt on the whole operation. If you
163163
// never call cb(), then you'll never get another chunk.
164164
Transform.prototype._transform = function(chunk, encoding, cb) {
165-
throw new ERR_METHOD_NOT_IMPLEMENTED('_transform');
165+
cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
166166
};
167167

168168
Transform.prototype._write = function(chunk, encoding, cb) {

lib/_stream_writable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ function clearBuffer(stream, state) {
553553
}
554554

555555
Writable.prototype._write = function(chunk, encoding, cb) {
556-
cb(new ERR_METHOD_NOT_IMPLEMENTED('_write'));
556+
cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
557557
};
558558

559559
Writable.prototype._writev = null;

lib/internal/errors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error);
849849
E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error);
850850
E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
851851
E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error);
852-
E('ERR_STREAM_READ_NOT_IMPLEMENTED', '_read() is not implemented', Error);
853852
E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT',
854853
'stream.unshift() after end event', Error);
855854
E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode', Error);

lib/internal/http2/core.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,19 +2073,12 @@ function afterOpen(session, options, headers, streamOptions, err, fd) {
20732073
headers, streamOptions));
20742074
}
20752075

2076-
function streamOnError(err) {
2077-
// we swallow the error for parity with HTTP1
2078-
// all the errors that ends here are not critical for the project
2079-
}
2080-
2081-
20822076
class ServerHttp2Stream extends Http2Stream {
20832077
constructor(session, handle, id, options, headers) {
20842078
super(session, options);
20852079
this[kInit](id, handle);
20862080
this[kProtocol] = headers[HTTP2_HEADER_SCHEME];
20872081
this[kAuthority] = headers[HTTP2_HEADER_AUTHORITY];
2088-
this.on('error', streamOnError);
20892082
}
20902083

20912084
// true if the remote peer accepts push streams

0 commit comments

Comments
 (0)