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 juanarbol committed Mar 3, 2023
1 parent 9c53e04 commit a0caca0
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 @@ -1480,7 +1480,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 a0caca0

Please sign in to comment.