diff options
author | Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> | 2022-04-11 01:34:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 01:34:11 +0300 |
commit | 951dbc045aebbe1f7eff12cedabce1179544dc75 (patch) | |
tree | a5a1ec9af54bd8da4d8e7195bba0d57b0c5a2627 /doc/api/buffer.md | |
parent | 65e838071bdf29d8e82bcfc1b0352884e2ba3af0 (diff) |
doc: remove unneeded new in Buffer example
PR-URL: https://github.com/nodejs/node/pull/42682
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 3f4c80015cf..3044e98c761 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1530,7 +1530,7 @@ a `Buffer` is that in this case one needs to specify the `byteOffset` correctly: import { Buffer } from 'buffer'; // Create a buffer smaller than `Buffer.poolSize`. -const nodeBuffer = new Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); +const nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // When casting the Node.js Buffer to an Int8Array, use the byteOffset // to refer only to the part of `nodeBuffer.buffer` that contains the memory @@ -1542,7 +1542,7 @@ new Int8Array(nodeBuffer.buffer, nodeBuffer.byteOffset, nodeBuffer.length); const { Buffer } = require('buffer'); // Create a buffer smaller than `Buffer.poolSize`. -const nodeBuffer = new Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); +const nodeBuffer = Buffer.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // When casting the Node.js Buffer to an Int8Array, use the byteOffset // to refer only to the part of `nodeBuffer.buffer` that contains the memory |