@@ -23,8 +23,6 @@ resized.
2323The ` Buffer ` class is a global within Node.js, making it unlikely that one
2424would need to ever use ` require('buffer').Buffer ` .
2525
26- Examples:
27-
2826``` js
2927// Creates a zero-filled Buffer of length 10.
3028const buf1 = Buffer .alloc (10 );
@@ -485,8 +483,6 @@ changes:
485483Creates a new ` Buffer ` containing the given JavaScript string ` string ` . If
486484provided, the ` encoding ` parameter identifies the character encoding of ` string ` .
487485
488- Examples:
489-
490486``` js
491487const buf1 = new Buffer (' this is a tést' );
492488const buf2 = new Buffer (' 7468697320697320612074c3a97374' , ' hex' );
@@ -895,8 +891,6 @@ added: v5.10.0
895891Creates a new ` Buffer ` containing the given JavaScript string ` string ` . If
896892provided, the ` encoding ` parameter identifies the character encoding of ` string ` .
897893
898- Examples:
899-
900894``` js
901895const buf1 = Buffer .from (' this is a tést' );
902896const 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
10541046const buf1 = Buffer .from (' ABC' );
10551047const buf2 = Buffer .from (' BCD' );
@@ -1074,8 +1066,6 @@ The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`
10741066arguments can be used to limit the comparison to specific ranges within ` target `
10751067and ` buf ` respectively.
10761068
1077- Examples:
1078-
10791069``` js
10801070const buf1 = Buffer .from ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ]);
10811071const buf2 = Buffer .from ([5 , 6 , 7 , 8 , 9 , 1 , 2 , 3 , 4 ]);
@@ -1185,8 +1175,6 @@ changes:
11851175Returns ` true ` if both ` buf ` and ` otherBuffer ` have exactly the same bytes,
11861176` false ` otherwise.
11871177
1188- Examples:
1189-
11901178``` js
11911179const buf1 = Buffer .from (' ABC' );
11921180const buf2 = Buffer .from (' 414243' , ' hex' );
@@ -1277,8 +1265,6 @@ added: v5.3.0
12771265
12781266Equivalent to [ ` buf.indexOf() !== -1 ` ] [ `buf.indexOf()` ] .
12791267
1280- Examples:
1281-
12821268``` js
12831269const 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
13331317const buf = Buffer .from (' this is a buffer' );
13341318
@@ -1427,8 +1411,6 @@ changes:
14271411Identical to [ ` buf.indexOf() ` ] , except ` buf ` is searched from back to front
14281412instead of front to back.
14291413
1430- Examples:
1431-
14321414``` js
14331415const buf = Buffer .from (' this buffer is a buffer' );
14341416
@@ -1513,8 +1495,6 @@ can result in undefined and inconsistent behavior. Applications that wish to
15131495modify the length of a ` Buffer ` should therefore treat ` length ` as read-only and
15141496use [ ` buf.slice() ` ] to create a new ` Buffer ` .
15151497
1516- Examples:
1517-
15181498``` js
15191499let buf = Buffer .allocUnsafe (10 );
15201500
@@ -1556,8 +1536,6 @@ Reads a 64-bit double from `buf` at the specified `offset` with specified
15561536endian format (` readDoubleBE() ` returns big endian, ` readDoubleLE() ` returns
15571537little endian).
15581538
1559- Examples:
1560-
15611539``` js
15621540const 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
15901568endian format (` readFloatBE() ` returns big endian, ` readFloatLE() ` returns
15911569little endian).
15921570
1593- Examples:
1594-
15951571``` js
15961572const 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
16241600Integers read from a ` Buffer ` are interpreted as two's complement signed values.
16251601
1626- Examples:
1627-
16281602``` js
16291603const buf = Buffer .from ([- 1 , 5 ]);
16301604
@@ -1656,8 +1630,6 @@ the specified endian format (`readInt16BE()` returns big endian,
16561630
16571631Integers read from a ` Buffer ` are interpreted as two's complement signed values.
16581632
1659- Examples:
1660-
16611633``` js
16621634const buf = Buffer .from ([0 , 5 ]);
16631635
@@ -1689,8 +1661,6 @@ the specified endian format (`readInt32BE()` returns big endian,
16891661
16901662Integers read from a ` Buffer ` are interpreted as two's complement signed values.
16911663
1692- Examples:
1693-
16941664``` js
16951665const buf = Buffer .from ([0 , 0 , 0 , 5 ]);
16961666
@@ -1721,8 +1691,6 @@ Reads `byteLength` number of bytes from `buf` at the specified `offset`
17211691and interprets the result as a two's complement signed value. Supports up to 48
17221692bits of accuracy.
17231693
1724- Examples:
1725-
17261694``` js
17271695const buf = Buffer .from ([0x12 , 0x34 , 0x56 , 0x78 , 0x90 , 0xab ]);
17281696
@@ -1751,8 +1719,6 @@ changes:
17511719
17521720Reads an unsigned 8-bit integer from ` buf ` at the specified ` offset ` .
17531721
1754- Examples:
1755-
17561722``` js
17571723const buf = Buffer .from ([1 , - 2 ]);
17581724
@@ -1782,8 +1748,6 @@ Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
17821748specified endian format (` readUInt16BE() ` returns big endian, ` readUInt16LE() `
17831749returns little endian).
17841750
1785- Examples:
1786-
17871751``` js
17881752const buf = Buffer .from ([0x12 , 0x34 , 0x56 ]);
17891753
@@ -1817,8 +1781,6 @@ Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
18171781specified endian format (` readUInt32BE() ` returns big endian,
18181782` readUInt32LE() ` returns little endian).
18191783
1820- Examples:
1821-
18221784``` js
18231785const buf = Buffer .from ([0x12 , 0x34 , 0x56 , 0x78 ]);
18241786
@@ -1849,8 +1811,6 @@ Reads `byteLength` number of bytes from `buf` at the specified `offset`
18491811and interprets the result as an unsigned integer. Supports up to 48
18501812bits of accuracy.
18511813
1852- Examples:
1853-
18541814``` js
18551815const buf = Buffer .from ([0x12 , 0x34 , 0x56 , 0x78 , 0x90 , 0xab ]);
18561816
@@ -1915,8 +1875,6 @@ console.log(buf2.toString('ascii', 0, buf2.length));
19151875Specifying negative indexes causes the slice to be generated relative to the
19161876end of ` buf ` rather than the beginning.
19171877
1918- Examples:
1919-
19201878``` js
19211879const buf = Buffer .from (' buffer' );
19221880
@@ -1943,8 +1901,6 @@ added: v5.10.0
19431901Interprets ` 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
19491905const buf1 = Buffer .from ([0x1 , 0x2 , 0x3 , 0x4 , 0x5 , 0x6 , 0x7 , 0x8 ]);
19501906
@@ -1972,8 +1928,6 @@ added: v5.10.0
19721928Interprets ` 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
19781932const buf1 = Buffer .from ([0x1 , 0x2 , 0x3 , 0x4 , 0x5 , 0x6 , 0x7 , 0x8 ]);
19791933
@@ -2001,8 +1955,6 @@ added: v6.3.0
20011955Interprets ` buf ` as an array of 64-bit numbers and swaps the byte-order * in-place* .
20021956Throws a ` RangeError ` if [ ` buf.length ` ] is not a multiple of 8.
20031957
2004- Examples:
2005-
20061958``` js
20071959const 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
20692021The maximum length of a string instance (in UTF-16 code units) is available
20702022as [ ` buffer.constants.MAX_STRING_LENGTH ` ] [ ] .
20712023
2072- Examples:
2073-
20742024``` js
20752025const buf1 = Buffer .allocUnsafe (26 );
20762026
@@ -2104,8 +2054,6 @@ added: v1.1.0
21042054Creates and returns an [ iterator] for ` buf ` values (bytes). This function is
21052055called automatically when a ` Buffer ` is used in a ` for..of ` statement.
21062056
2107- Examples:
2108-
21092057``` js
21102058const buf = Buffer .from (' buffer' );
21112059
@@ -2179,8 +2127,6 @@ format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
21792127endian). ` 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
21852131const buf = Buffer .allocUnsafe (8 );
21862132
@@ -2215,8 +2161,6 @@ format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
22152161endian). ` 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
22212165const 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
22572199const 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
22912231const 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
23252263const buf = Buffer .allocUnsafe (8 );
23262264
@@ -2351,8 +2289,6 @@ Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
23512289Supports up to 48 bits of accuracy. Behavior is undefined when ` value ` is
23522290anything other than a signed integer.
23532291
2354- Examples:
2355-
23562292``` js
23572293const buf = Buffer .allocUnsafe (6 );
23582294
@@ -2385,8 +2321,6 @@ Writes `value` to `buf` at the specified `offset`. `value` *should* be a
23852321valid unsigned 8-bit integer. Behavior is undefined when ` value ` is anything
23862322other than an unsigned 8-bit integer.
23872323
2388- Examples:
2389-
23902324``` js
23912325const buf = Buffer .allocUnsafe (4 );
23922326
@@ -2419,8 +2353,6 @@ format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
24192353endian). ` value ` should be a valid unsigned 16-bit integer. Behavior is
24202354undefined when ` value ` is anything other than an unsigned 16-bit integer.
24212355
2422- Examples:
2423-
24242356``` js
24252357const buf = Buffer .allocUnsafe (4 );
24262358
@@ -2457,8 +2389,6 @@ format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
24572389endian). ` value ` should be a valid unsigned 32-bit integer. Behavior is
24582390undefined when ` value ` is anything other than an unsigned 32-bit integer.
24592391
2460- Examples:
2461-
24622392``` js
24632393const buf = Buffer .allocUnsafe (4 );
24642394
@@ -2494,8 +2424,6 @@ Writes `byteLength` bytes of `value` to `buf` at the specified `offset`.
24942424Supports up to 48 bits of accuracy. Behavior is undefined when ` value ` is
24952425anything other than an unsigned integer.
24962426
2497- Examples:
2498-
24992427``` js
25002428const buf = Buffer .allocUnsafe (6 );
25012429
0 commit comments