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 <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
deokjinkim authored and juanarbol committed Mar 5, 2023
1 parent 37a6ce1 commit 8113220
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 8113220

Please sign in to comment.