diff options
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 650e9ed981..78c90045af 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -478,8 +478,8 @@ changes: > Stability: 0 - Deprecated: > Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead. -* `string` {String} String to encode -* `encoding` {String} The encoding of `string`. **Default:** `'utf8'` +* `string` {string} String to encode +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` Creates a new `Buffer` containing the given JavaScript string `string`. If provided, the `encoding` parameter identifies the character encoding of `string`. @@ -508,9 +508,9 @@ added: v5.10.0 --> * `size` {Integer} The desired length of the new `Buffer` -* `fill` {String | Buffer | Integer} A value to pre-fill the new `Buffer` with. +* `fill` {string | Buffer | Integer} A value to pre-fill the new `Buffer` with. **Default:** `0` -* `encoding` {String} If `fill` is a string, this is its encoding. +* `encoding` {string} If `fill` is a string, this is its encoding. **Default:** `'utf8'` Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the @@ -674,9 +674,9 @@ changes: or `ArrayBuffer`. --> -* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} A value to +* `string` {string | Buffer | TypedArray | DataView | ArrayBuffer} A value to calculate the length of -* `encoding` {String} If `string` is a string, this is its encoding. +* `encoding` {string} If `string` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Integer} The number of bytes contained within `string` @@ -876,8 +876,8 @@ A `TypeError` will be thrown if `buffer` is not a `Buffer`. added: v5.10.0 --> -* `string` {String} A string to encode. -* `encoding` {String} The encoding of `string`. **Default:** `'utf8'` +* `string` {string} A string to encode. +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` Creates a new `Buffer` containing the given JavaScript string `string`. If provided, the `encoding` parameter identifies the character encoding of `string`. @@ -917,7 +917,7 @@ Returns `true` if `obj` is a `Buffer`, `false` otherwise. added: v0.9.1 --> -* `encoding` {String} A character encoding name to check +* `encoding` {string} A character encoding name to check * Returns: {Boolean} Returns `true` if `encoding` contains a supported character encoding, or `false` @@ -1170,10 +1170,10 @@ changes: description: The `encoding` parameter is supported now. --> -* `value` {String | Buffer | Integer} The value to fill `buf` with +* `value` {string | Buffer | Integer} The value to fill `buf` with * `offset` {Integer} Where to start filling `buf`. **Default:** `0` * `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] -* `encoding` {String} If `value` is a string, this is its encoding. +* `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Buffer} A reference to `buf` @@ -1207,9 +1207,9 @@ console.log(Buffer.allocUnsafe(3).fill('\u0222')); added: v5.3.0 --> -* `value` {String | Buffer | Integer} What to search for +* `value` {string | Buffer | Integer} What to search for * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` -* `encoding` {String} If `value` is a string, this is its encoding. +* `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise @@ -1256,9 +1256,9 @@ changes: is no longer required. --> -* `value` {String | Buffer | Uint8Array | Integer} What to search for +* `value` {string | Buffer | Uint8Array | Integer} What to search for * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` -* `encoding` {String} If `value` is a string, this is its encoding. +* `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Integer} The index of the first occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` @@ -1365,10 +1365,10 @@ changes: description: The `value` can now be a `Uint8Array`. --> -* `value` {String | Buffer | Uint8Array | Integer} What to search for +* `value` {string | Buffer | Uint8Array | Integer} What to search for * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** [`buf.length`]` - 1` -* `encoding` {String} If `value` is a string, this is its encoding. +* `encoding` {string} If `value` is a string, this is its encoding. **Default:** `'utf8'` * Returns: {Integer} The index of the last occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` @@ -1501,7 +1501,7 @@ added: v0.11.15 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Number} Reads a 64-bit double from `buf` at the specified `offset` with specified @@ -1537,7 +1537,7 @@ added: v0.11.15 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Number} Reads a 32-bit float from `buf` at the specified `offset` with specified @@ -1572,7 +1572,7 @@ added: v0.5.0 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 8-bit integer from `buf` at the specified `offset`. @@ -1604,7 +1604,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 16-bit integer from `buf` at the specified `offset` with @@ -1638,7 +1638,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads a signed 32-bit integer from `buf` at the specified `offset` with @@ -1673,7 +1673,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` * Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` @@ -1704,7 +1704,7 @@ added: v0.5.0 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 8-bit integer from `buf` at the specified `offset`. @@ -1734,7 +1734,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 16-bit integer from `buf` at the specified `offset` with @@ -1772,7 +1772,7 @@ added: v0.5.5 --> * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` validation? **Default:** `false` * Returns: {Integer} Reads an unsigned 32-bit integer from `buf` at the specified `offset` with @@ -1805,7 +1805,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` +* `noAssert` {boolean} Skip `offset` and `byteLength` validation? **Default:** `false` * Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` @@ -2025,7 +2025,7 @@ console.log(copy); added: v0.1.90 --> -* `encoding` {String} The character encoding to decode to. **Default:** `'utf8'` +* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'` * `start` {Integer} The byte offset to start decoding at. **Default:** `0` * `end` {Integer} The byte offset to stop decoding at (not inclusive). **Default:** [`buf.length`] @@ -2106,10 +2106,10 @@ for (const value of buf) { added: v0.1.90 --> -* `string` {String} String to be written to `buf` +* `string` {string} String to be written to `buf` * `offset` {Integer} Where to start writing `string`. **Default:** `0` * `length` {Integer} How many bytes to write. **Default:** `buf.length - offset` -* `encoding` {String} The character encoding of `string`. **Default:** `'utf8'` +* `encoding` {string} The character encoding of `string`. **Default:** `'utf8'` * Returns: {Integer} Number of bytes written Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. @@ -2134,9 +2134,9 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); added: v0.11.15 --> -* `value` {Number} Number to be written to `buf` +* `value` {number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2169,9 +2169,9 @@ console.log(buf); added: v0.11.15 --> -* `value` {Number} Number to be written to `buf` +* `value` {number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2205,7 +2205,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid @@ -2237,7 +2237,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2270,7 +2270,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2304,7 +2304,7 @@ added: v0.11.15 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? +* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written @@ -2338,7 +2338,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a @@ -2370,7 +2370,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2407,7 +2407,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` -* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` +* `noAssert` {boolean} Skip `value` and `offset` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian @@ -2443,7 +2443,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` -* `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? +* `noAssert` {boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` * Returns: {Integer} `offset` plus the number of bytes written @@ -2507,8 +2507,8 @@ changes: --> * `source` {Buffer|Uint8Array} A `Buffer` or `Uint8Array` instance -* `fromEnc` {String} The current encoding -* `toEnc` {String} To target encoding +* `fromEnc` {string} The current encoding +* `toEnc` {string} To target encoding Re-encodes the given `Buffer` or `Uint8Array` instance from one character encoding to another. Returns a new `Buffer` instance. |