Skip to content

Commit 8113220

Browse files
deokjinkimjuanarbol
authored andcommitted
doc: pass string to textEncoder.encode as input
Input of `textEncoder.encode` should be string, not array. Refs: https://nodejs.org/dist/latest-v19.x/docs/api/util.html#textencoderencodeinput PR-URL: #46421 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 37a6ce1 commit 8113220

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/api/webstreams.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ const { Readable } = require('node:stream');
14801480
const { TextEncoder } = require('node:util');
14811481

14821482
const encoder = new TextEncoder();
1483-
const dataArray = encoder.encode(['hello world from consumers!']);
1483+
const dataArray = encoder.encode('hello world from consumers!');
14841484
const readable = Readable.from(dataArray);
14851485
arrayBuffer(readable).then((data) => {
14861486
console.log(`from readable: ${data.byteLength}`);

0 commit comments

Comments
 (0)