diff options
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 2d9be90381..f3514f20b7 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -345,9 +345,9 @@ changes: * `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`] or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. * `length` {integer} Number of bytes to expose. - **Default:** `arrayBuffer.length - byteOffset` + **Default:** `arrayBuffer.length - byteOffset`. This creates a view of the [`ArrayBuffer`] or [`SharedArrayBuffer`] without copying the underlying memory. For example, when passed a reference to the @@ -459,7 +459,7 @@ changes: > Use [`Buffer.from(string[, encoding])`][`Buffer.from(string)`] instead. * `string` {string} String to encode. -* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. Creates a new `Buffer` containing `string`. The `encoding` parameter identifies the character encoding of `string`. @@ -496,9 +496,9 @@ changes: * `size` {integer} The desired length of the new `Buffer`. * `fill` {string|Buffer|integer} A value to pre-fill the new `Buffer` with. - **Default:** `0` + **Default:** `0`. * `encoding` {string} If `fill` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be *zero-filled*. @@ -654,7 +654,7 @@ changes: * `string` {string|Buffer|TypedArray|DataView|ArrayBuffer|SharedArrayBuffer} A value to calculate the length of. * `encoding` {string} If `string` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The number of bytes contained within `string`. Returns the actual byte length of a string. This is not the same as @@ -774,9 +774,9 @@ added: v5.10.0 * `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An [`ArrayBuffer`], [`SharedArrayBuffer`], or the `.buffer` property of a [`TypedArray`]. -* `byteOffset` {integer} Index of first byte to expose. **Default:** `0` +* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`. * `length` {integer} Number of bytes to expose. - **Default:** `arrayBuffer.length - byteOffset` + **Default:** `arrayBuffer.length - byteOffset`. This creates a view of the [`ArrayBuffer`] without copying the underlying memory. For example, when passed a reference to the `.buffer` property of a @@ -845,7 +845,7 @@ added: v5.10.0 --> * `string` {string} A string to encode. -* `encoding` {string} The encoding of `string`. **Default:** `'utf8'` +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. Creates a new `Buffer` containing `string`. The `encoding` parameter identifies the character encoding of `string`. @@ -984,13 +984,13 @@ changes: * `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to compare to. * `targetStart` {integer} The offset within `target` at which to begin - comparison. **Default:** `0` + comparison. **Default:** `0`. * `targetEnd` {integer} The offset with `target` at which to end comparison - (not inclusive). **Default:** `target.length` + (not inclusive). **Default:** `target.length`. * `sourceStart` {integer} The offset within `buf` at which to begin comparison. - **Default:** `0` + **Default:** `0`. * `sourceEnd` {integer} The offset within `buf` at which to end comparison - (not inclusive). **Default:** [`buf.length`] + (not inclusive). **Default:** [`buf.length`]. * Returns: {integer} Compares `buf` with `target` and returns a number indicating whether `buf` @@ -1047,11 +1047,11 @@ added: v0.1.90 * `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to copy into. * `targetStart` {integer} The offset within `target` at which to begin - copying to. **Default:** `0` + copying to. **Default:** `0`. * `sourceStart` {integer} The offset within `buf` at which to begin copying from. - **Default:** `0` + **Default:** `0`. * `sourceEnd` {integer} The offset within `buf` at which to stop copying (not - inclusive). **Default:** [`buf.length`] + inclusive). **Default:** [`buf.length`]. * Returns: {integer} The number of bytes copied. Copies data from a region of `buf` to a region in `target` even if the `target` @@ -1165,10 +1165,10 @@ changes: --> * `value` {string|Buffer|integer} The value to fill `buf` with. -* `offset` {integer} Number of bytes to skip before starting to fill `buf`. **Default:** `0` -* `end` {integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] +* `offset` {integer} Number of bytes to skip before starting to fill `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. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {Buffer} A reference to `buf`. Fills `buf` with the specified `value`. If the `offset` and `end` are not given, @@ -1216,9 +1216,9 @@ added: v5.3.0 --> * `value` {string|Buffer|integer} What to search for. -* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {boolean} `true` if `value` was found in `buf`, `false` otherwise. Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. @@ -1256,9 +1256,9 @@ changes: --> * `value` {string|Buffer|Uint8Array|integer} What to search for. -* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0` +* `byteOffset` {integer} Where to begin searching in `buf`. **Default:** `0`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The index of the first occurrence of `value` in `buf` or `-1` if `buf` does not contain `value`. @@ -1358,9 +1358,9 @@ changes: * `value` {string|Buffer|Uint8Array|integer} What to search for. * `byteOffset` {integer} Where to begin searching in `buf`. - **Default:** [`buf.length`]` - 1` + **Default:** [`buf.length`]` - 1`. * `encoding` {string} If `value` is a string, this is its encoding. - **Default:** `'utf8'` + **Default:** `'utf8'`. * Returns: {integer} The index of the last occurrence of `value` in `buf` or `-1` if `buf` does not contain `value`. @@ -1792,9 +1792,9 @@ changes: calculations with them. --> -* `start` {integer} Where the new `Buffer` will start. **Default:** `0` +* `start` {integer} Where the new `Buffer` will start. **Default:** `0`. * `end` {integer} Where the new `Buffer` will end (not inclusive). - **Default:** [`buf.length`] + **Default:** [`buf.length`]. * Returns: {Buffer} Returns a new `Buffer` that references the same memory as the original, but @@ -1963,10 +1963,10 @@ console.log(copy); added: v0.1.90 --> -* `encoding` {string} The character encoding to decode to. **Default:** `'utf8'` -* `start` {integer} The byte offset to start decoding at. **Default:** `0` +* `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`] + **Default:** [`buf.length`]. * Returns: {string} Decodes `buf` to a string according to the specified character encoding in @@ -2040,9 +2040,9 @@ added: v0.1.90 --> * `string` {string} String to be written to `buf`. -* `offset` {integer} Number of bytes to skip before starting to write `string`. **Default:** `0` -* `length` {integer} Number of bytes to write. **Default:** `buf.length - offset` -* `encoding` {string} The character encoding of `string`. **Default:** `'utf8'` +* `offset` {integer} Number of bytes to skip before starting to write `string`. **Default:** `0`. +* `length` {integer} Number of bytes to write. **Default:** `buf.length - offset`. +* `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`. @@ -2369,7 +2369,7 @@ changes: * `value` {integer} Number to be written to `buf`. * `offset` {integer} Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - byteLength`. * `byteLength` {integer} Number of bytes to write. Must satisfy: `0 < byteLength <= 6`. - **Default:** `false` + **Default:** `false`. * Returns: {integer} `offset` plus the number of bytes written. Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. |