diff --git a/doc/api/buffer.md b/doc/api/buffer.md index a97ab6c2a6314b..e614851bb5250e 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -311,12 +311,12 @@ for (const b of buf) { Additionally, the [`buf.values()`][], [`buf.keys()`][], and [`buf.entries()`][] methods can be used to create iterators. -## Class: Buffer +## Class: `Buffer` The `Buffer` class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. -### new Buffer(array) +### `new Buffer(array)` @@ -677,7 +677,7 @@ developer has observed undue memory retention in their applications. A `TypeError` will be thrown if `size` is not a number. -### Class Method: Buffer.byteLength(string\[, encoding\]) +### Class Method: `Buffer.byteLength(string[, encoding])` @@ -808,7 +808,7 @@ const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); A `TypeError` will be thrown if `array` is not an `Array` or other type appropriate for `Buffer.from()` variants. -### Class Method: Buffer.from(arrayBuffer\[, byteOffset\[, length\]\]) +### Class Method: `Buffer.from(arrayBuffer[, byteOffset[, length]])` @@ -857,7 +857,7 @@ console.log(buf.length); A `TypeError` will be thrown if `arrayBuffer` is not an [`ArrayBuffer`][] or a [`SharedArrayBuffer`][] or other type appropriate for `Buffer.from()` variants. -### Class Method: Buffer.from(buffer) +### Class Method: `Buffer.from(buffer)` @@ -882,7 +882,7 @@ console.log(buf2.toString()); A `TypeError` will be thrown if `buffer` is not a `Buffer` or other type appropriate for `Buffer.from()` variants. -### Class Method: Buffer.from(object\[, offsetOrEncoding\[, length\]\]) +### Class Method: `Buffer.from(object[, offsetOrEncoding[, length]])` @@ -919,7 +919,7 @@ const buf = Buffer.from(new Foo(), 'utf8'); A `TypeError` will be thrown if `object` has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants. -### Class Method: Buffer.from(string\[, encoding\]) +### Class Method: `Buffer.from(string[, encoding])` @@ -945,7 +945,7 @@ console.log(buf1.toString('ascii')); A `TypeError` will be thrown if `string` is not a string or other type appropriate for `Buffer.from()` variants. -### Class Method: Buffer.isBuffer(obj) +### Class Method: `Buffer.isBuffer(obj)` @@ -955,7 +955,7 @@ added: v0.1.101 Returns `true` if `obj` is a `Buffer`, `false` otherwise. -### Class Method: Buffer.isEncoding(encoding) +### Class Method: `Buffer.isEncoding(encoding)` @@ -980,7 +980,7 @@ console.log(Buffer.isEncoding('')); // Prints: false ``` -### Class Property: Buffer.poolSize +### Class Property: `Buffer.poolSize` @@ -990,7 +990,7 @@ added: v0.11.3 This is the size (in bytes) of pre-allocated internal `Buffer` instances used for pooling. This value may be modified. -### buf\[index\] +### `buf[index]` @@ -1183,7 +1183,7 @@ console.log(buf.toString()); // Prints: efghijghijklmnopqrstuvwxyz ``` -### buf.entries() +### `buf.entries()` @@ -1210,7 +1210,7 @@ for (const pair of buf.entries()) { // [5, 114] ``` -### buf.equals(otherBuffer) +### `buf.equals(otherBuffer)` @@ -1342,7 +1342,7 @@ console.log(buf.includes('this', 4)); // Prints: false ``` -### buf.indexOf(value\[, byteOffset\]\[, encoding\]) +### `buf.indexOf(value[, byteOffset][, encoding])` @@ -1449,7 +1449,7 @@ for (const key of buf.keys()) { // 5 ``` -### buf.lastIndexOf(value\[, byteOffset\]\[, encoding\]) +### `buf.lastIndexOf(value[, byteOffset][, encoding])` @@ -1569,7 +1569,7 @@ console.log(buf.length); // Prints: 5 ``` -### buf.parent +### `buf.parent` @@ -1578,8 +1578,8 @@ deprecated: v8.0.0 The `buf.parent` property is a deprecated alias for `buf.buffer`. -### buf.readBigInt64BE(\[offset\]) -### buf.readBigInt64LE(\[offset\]) +### `buf.readBigInt64BE([offset])` +### `buf.readBigInt64LE([offset])` @@ -1594,8 +1594,8 @@ the specified endian format (`readBigInt64BE()` returns big endian, Integers read from a `Buffer` are interpreted as two's complement signed values. -### buf.readBigUInt64BE(\[offset\]) -### buf.readBigUInt64LE(\[offset\]) +### `buf.readBigUInt64BE([offset])` +### `buf.readBigUInt64LE([offset])` @@ -1618,8 +1618,8 @@ console.log(buf.readBigUInt64LE(0)); // Prints: 18446744069414584320n ``` -### buf.readDoubleBE(\[offset\]) -### buf.readDoubleLE(\[offset\]) +### `buf.readDoubleBE([offset])` +### `buf.readDoubleLE([offset])` @@ -1988,7 +1988,7 @@ console.log(buf.subarray(-5, -2).toString()); // (Equivalent to buf.subarray(1, 4).) ``` -### buf.slice(\[start\[, end\]\]) +### `buf.slice([start[, end]])` @@ -2064,7 +2064,7 @@ const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); buf.swap16(); // Convert to big-endian UTF-16 text. ``` -### buf.swap32() +### `buf.swap32()` @@ -2092,7 +2092,7 @@ buf2.swap32(); // Throws ERR_INVALID_BUFFER_SIZE. ``` -### buf.swap64() +### `buf.swap64()` @@ -2122,7 +2122,7 @@ buf2.swap64(); JavaScript cannot encode 64-bit integers. This method is intended for working with 64-bit floats. -### buf.toJSON() +### `buf.toJSON()` @@ -2149,7 +2149,7 @@ console.log(copy); // Prints: ``` -### buf.toString(\[encoding\[, start\[, end\]\]\]) +### `buf.toString([encoding[, start[, end]]])` @@ -2189,7 +2189,7 @@ console.log(buf2.toString(undefined, 0, 3)); // Prints: té ``` -### buf.values() +### `buf.values()` @@ -2225,7 +2225,7 @@ for (const value of buf) { // 114 ``` -### buf.write(string\[, offset\[, length\]\]\[, encoding\]) +### `buf.write(string[, offset[, length]][, encoding])` @@ -2252,8 +2252,8 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); // Prints: 12 bytes: ½ + ¼ = ¾ ``` -### buf.writeBigInt64BE(value\[, offset\]) -### buf.writeBigInt64LE(value\[, offset\]) +### `buf.writeBigInt64BE(value[, offset])` +### `buf.writeBigInt64LE(value[, offset])` @@ -2278,8 +2278,8 @@ console.log(buf); // Prints: ``` -### buf.writeBigUInt64BE(value\[, offset\]) -### buf.writeBigUInt64LE(value\[, offset\]) +### `buf.writeBigUInt64BE(value[, offset])` +### `buf.writeBigUInt64LE(value[, offset])` @@ -2302,8 +2302,8 @@ console.log(buf); // Prints: ``` -### buf.writeDoubleBE(value\[, offset\]) -### buf.writeDoubleLE(value\[, offset\]) +### `buf.writeDoubleBE(value[, offset])` +### `buf.writeDoubleLE(value[, offset])` @@ -2658,7 +2658,7 @@ Returns the maximum number of bytes that will be returned when This is a property on the `buffer` module returned by `require('buffer')`, not on the `Buffer` global or a `Buffer` instance. -## buffer.kMaxLength +## `buffer.kMaxLength` @@ -2670,7 +2670,7 @@ An alias for [`buffer.constants.MAX_LENGTH`][]. This is a property on the `buffer` module returned by `require('buffer')`, not on the `Buffer` global or a `Buffer` instance. -## buffer.transcode(source, fromEnc, toEnc) +## `buffer.transcode(source, fromEnc, toEnc)` @@ -2748,7 +2748,7 @@ socket.on('readable', () => { Use of `SlowBuffer` should be used only as a last resort *after* a developer has observed undue memory retention in their applications. -### new SlowBuffer(size) +### `new SlowBuffer(size)` @@ -2788,7 +2788,7 @@ added: v8.2.0 `buffer.constants` is a property on the `buffer` module returned by `require('buffer')`, not on the `Buffer` global or a `Buffer` instance. -### buffer.constants.MAX_LENGTH +### `buffer.constants.MAX_LENGTH` @@ -2800,7 +2800,7 @@ On 64-bit architectures, this value is `(2^31)-1` (~2GB). This value is also available as [`buffer.kMaxLength`][]. -### buffer.constants.MAX_STRING_LENGTH +### `buffer.constants.MAX_STRING_LENGTH`