From 0e0d45b02fd0a98baaac428292312e47b0db8e30 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 23 Dec 2019 13:10:25 -0800 Subject: [PATCH] doc,buffer: use code markup/markdown in headers PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/buffer.md | 188 +++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index c5b7bf15047177..c94f03fa065a36 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]]])` @@ -2191,7 +2191,7 @@ console.log(buf2.toString(undefined, 0, 3)); // Prints: té ``` -### buf.values() +### `buf.values()` @@ -2227,7 +2227,7 @@ for (const value of buf) { // 114 ``` -### buf.write(string\[, offset\[, length\]\]\[, encoding\]) +### `buf.write(string[, offset[, length]][, encoding])` @@ -2254,8 +2254,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])` @@ -2280,8 +2280,8 @@ console.log(buf); // Prints: ``` -### buf.writeBigUInt64BE(value\[, offset\]) -### buf.writeBigUInt64LE(value\[, offset\]) +### `buf.writeBigUInt64BE(value[, offset])` +### `buf.writeBigUInt64LE(value[, offset])` @@ -2304,8 +2304,8 @@ console.log(buf); // Prints: ``` -### buf.writeDoubleBE(value\[, offset\]) -### buf.writeDoubleLE(value\[, offset\]) +### `buf.writeDoubleBE(value[, offset])` +### `buf.writeDoubleLE(value[, offset])` @@ -2660,7 +2660,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` @@ -2672,7 +2672,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)` @@ -2750,7 +2750,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)` @@ -2790,7 +2790,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` @@ -2802,7 +2802,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`