Skip to content

Commit 3145d10

Browse files
committed
doc: add added date meta
1 parent 2eca8b0 commit 3145d10

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

doc/api/buffer.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,6 +3548,10 @@ console.log(buf.asciiSlice(0, 3));
35483548

35493549
### `buf.base64Slice([start[, end]])`
35503550

3551+
<!-- YAML
3552+
added: v0.11.3
3553+
-->
3554+
35513555
* `start` {integer} The byte offset to start slicing at. **Default**: 0.
35523556
* `end` {integer} The byte offset to stop decoding at (not inclusive).
35533557
**Default**: `buf.length`.
@@ -3576,6 +3580,10 @@ console.log(buf.base64Slice(0, 3));
35763580

35773581
### `buf.base64urlSlice([start[, end]])`
35783582

3583+
<!-- YAML
3584+
added: v14.18.0
3585+
-->
3586+
35793587
* `start` {integer} The byte offset to start slicing at. **Default**: 0.
35803588
* `end` {integer} The byte offset to stop decoding at (not inclusive).
35813589
**Default**: `buf.length`.
@@ -3604,6 +3612,10 @@ console.log(buf.base64urlSlice(0, 3));
36043612

36053613
### `buf.hexSlice([start[, end]])`
36063614

3615+
<!-- YAML
3616+
added: v0.11.3
3617+
-->
3618+
36073619
* `start` {integer} The byte offset to start slicing at. **Default**: 0.
36083620
* `end` {integer} The byte offset to stop decoding at (not inclusive).
36093621
**Default**: `buf.length`.
@@ -3632,6 +3644,10 @@ console.log(buf.hexSlice(0, 3));
36323644

36333645
### `buf.latin1Slice([start[, end]])`
36343646

3647+
<!-- YAML
3648+
added: v6.4.0
3649+
-->
3650+
36353651
* `start` {integer} The byte offset to start slicing at. **Default**: 0.
36363652
* `end` {integer} The byte offset to stop slicing at (not inclusive).
36373653
**Default**: `buf.length`.
@@ -3660,6 +3676,10 @@ console.log(buf.latin1Slice(0, 3));
36603676

36613677
### `buf.ucs2Slice([start[, end]])`
36623678

3679+
<!-- YAML
3680+
added: v0.11.3
3681+
-->
3682+
36633683
* `start` {integer} The byte offset to start slicing at. **Default**: 0.
36643684
* `end` {integer} The byte offset to stop slicing at (not inclusive).
36653685
**Default**: `buf.length`.
@@ -3748,6 +3768,10 @@ console.log(bytesWritten);
37483768

37493769
### `buf.base64Write(string[, offset[, length]])`
37503770

3771+
<!-- YAML
3772+
added: v0.11.3
3773+
-->
3774+
37513775
* `string` {string} String to write to `buf`.
37523776
* `offset` {integer} Number of bytes to skip before starting to write
37533777
`string`. **Default**: 0.
@@ -3782,6 +3806,10 @@ console.log(bytesWritten);
37823806

37833807
### `buf.base64urlWrite(string[, offset[, length]])`
37843808

3809+
<!-- YAML
3810+
added: v14.18.0
3811+
-->
3812+
37853813
* `string` {string} String to write to `buf`.
37863814
* `offset` {integer} Number of bytes to skip before starting to write `string`.
37873815
**Default**: 0.
@@ -3816,6 +3844,10 @@ console.log(bytesWritten);
38163844

38173845
### `buf.hexWrite(string[, offset[, length]])`
38183846

3847+
<!-- YAML
3848+
added: v0.11.3
3849+
-->
3850+
38193851
* `string` {string} String to write to `buf`.
38203852
* `offset` {integer} Number of bytes to skip before starting to write
38213853
`string`. **Default**: 0.
@@ -3850,6 +3882,10 @@ console.log(bytesWritten);
38503882

38513883
### `buf.latin1Write(string[, offset[, length]])`
38523884

3885+
<!-- YAML
3886+
added: v6.4.0
3887+
-->
3888+
38533889
* `string` {string} String to write to `buf`.
38543890
* `offset` {integer} Number of bytes to skip before starting to write
38553891
`string`. **Default**: 0.
@@ -3882,6 +3918,44 @@ console.log(bytesWritten);
38823918
// Prints: 2
38833919
```
38843920

3921+
### `buf.ucs2Write([start[, end]])`
3922+
3923+
<!-- YAML
3924+
added: v0.11.3
3925+
-->
3926+
3927+
* `string` {string} String to write to `buf`.
3928+
* `offset` {integer} Number of bytes to skip before starting to write
3929+
`string`. **Default**: 0.
3930+
* `length` {integer} Maximum number of bytes to write. **Default**: `buf.
3931+
length - offset`.
3932+
* Returns: {integer} The number of bytes written.
3933+
3934+
Writes `string` to `buf` at `offset` according to the UCS-2 character encoding
3935+
and returns the number of bytes written. If `buf` did not contain enough space
3936+
to fit the entire string, only part of `string` will be written. However,
3937+
partially encoded characters will not be written.
3938+
3939+
In most cases, `buf.write` is preferable, especially if `encoding` is variable.
3940+
3941+
```mjs
3942+
import { Buffer } from 'node:buffer';
3943+
const buf = Buffer.alloc(10);
3944+
3945+
const bytesWritten = buf.ucs2Write('buffer');
3946+
console.log(bytesWritten);
3947+
// Prints: 4
3948+
```
3949+
3950+
```cjs
3951+
const { Buffer } = require('node:buffer');
3952+
const buf = Buffer.alloc(10);
3953+
3954+
const bytesWritten = buf.ucs2Write('buffer');
3955+
console.log(bytesWritten);
3956+
// Prints: 4
3957+
```
3958+
38853959
### `buf.utf8Write(string[, offset[, length]])`
38863960

38873961
* `string` {string} String to write to `buf`.

0 commit comments

Comments
 (0)