From c5cd324fcd1c98f646bc7ddd5833736f13982981 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Thu, 20 Apr 2023 18:47:38 +0900 Subject: [PATCH] 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 Reviewed-By: Antoine du Hamel Reviewed-By: Akhil Marsonya Reviewed-By: Luigi Pinca Reviewed-By: Harshitha K P --- doc/api/buffer.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index a76de94f49dabf..f5f12077742aef 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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']); @@ -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']); @@ -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