diff options
author | Deokjin Kim <deokjin81.kim@gmail.com> | 2023-04-20 18:47:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 09:47:38 +0000 |
commit | de5787c87c557e02523b3e6104445c6427a44f25 (patch) | |
tree | c65ec990803e6a5c0884ca144d74f4844a99fcf4 /doc/api | |
parent | 607715e52ad675a31014ef1848053d181e92eeff (diff) | |
download | node-new-de5787c87c557e02523b3e6104445c6427a44f25.tar.gz |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/buffer.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index f4b5b18a1b..38b7a619d8 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -581,7 +581,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']); @@ -608,7 +608,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']); @@ -1075,7 +1075,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 |