Skip to content

Commit

Permalink
doc: pass string to textEncoder.encode as input
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
deokjinkim authored and ruyadorno committed Jan 31, 2023
1 parent b966ef9 commit 891d18d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/api/webstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ const { Readable } = require('node:stream');
const { TextEncoder } = require('node:util');

const encoder = new TextEncoder();
const dataArray = encoder.encode(['hello world from consumers!']);
const dataArray = encoder.encode('hello world from consumers!');
const readable = Readable.from(dataArray);
arrayBuffer(readable).then((data) => {
console.log(`from readable: ${data.byteLength}`);
Expand Down

0 comments on commit 891d18d

Please sign in to comment.