Skip to content

Commit

Permalink
doc: change offset of example in Buffer.copyBytesFrom
Browse files Browse the repository at this point in the history
Actual output is different from expected output if offset is 0.
Plus, removed unused importing `Buffer`.

PR-URL: #47606
Reviewed-By: Debadree Chatterjee <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
  • Loading branch information
deokjinkim authored and danielleadams committed Jul 6, 2023
1 parent 383a3f8 commit c5cd324
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ contained by the `Blob` is copied only when the `arrayBuffer()` or `text()`
methods are called.

```mjs
import { Blob, Buffer } from 'node:buffer';
import { Blob } from 'node:buffer';
import { setTimeout as delay } from 'node:timers/promises';

const blob = new Blob(['hello there']);
Expand All @@ -606,7 +606,7 @@ blob.text().then(console.log);
```

```cjs
const { Blob, Buffer } = require('node:buffer');
const { Blob } = require('node:buffer');
const { setTimeout: delay } = require('node:timers/promises');

const blob = new Blob(['hello there']);
Expand Down Expand Up @@ -1071,7 +1071,7 @@ Copies the underlying memory of `view` into a new `Buffer`.

```js
const u16 = new Uint16Array([0, 0xffff]);
const buf = Buffer.copyBytesFrom(u16, 0, 1);
const buf = Buffer.copyBytesFrom(u16, 1, 1);
u16[1] = 0;
console.log(buf.length); // 2
console.log(buf[0]); // 255
Expand Down

0 comments on commit c5cd324

Please sign in to comment.