Skip to content

Commit ec5c919

Browse files
deokjinkimMoLow
authored andcommitted
doc: change offset of example in Buffer.copyBytesFrom
Actual output is different from expected output if offset is 0. Plus, removed unused importing `Buffer`. PR-URL: #47606 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com>
1 parent 3f0636d commit ec5c919

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎doc/api/buffer.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ contained by the `Blob` is copied only when the `arrayBuffer()` or `text()`
579579
methods are called.
580580

581581
```mjs
582-
import { Blob, Buffer } from'node:buffer';
582+
import { Blob } from'node:buffer';
583583
import { setTimeoutasdelay } from'node:timers/promises';
584584

585585
constblob=newBlob(['hello there']);
@@ -606,7 +606,7 @@ blob.text().then(console.log);
606606
```
607607

608608
```cjs
609-
const { Blob, Buffer } =require('node:buffer');
609+
const { Blob } =require('node:buffer');
610610
const { setTimeout:delay } =require('node:timers/promises');
611611

612612
constblob=newBlob(['hello there']);
@@ -1071,7 +1071,7 @@ Copies the underlying memory of `view` into a new `Buffer`.
10711071

10721072
```js
10731073
constu16=newUint16Array([0, 0xffff]);
1074-
constbuf=Buffer.copyBytesFrom(u16, 0, 1);
1074+
constbuf=Buffer.copyBytesFrom(u16, 1, 1);
10751075
u16[1] =0;
10761076
console.log(buf.length); // 2
10771077
console.log(buf[0]); // 255

0 commit comments

Comments
 (0)