Skip to content
masterclass Buddy

Node.js · Class

TextEncoder

TextEncoder converts JavaScript strings to UTF-8 bytes. Use encode() for a new Uint8Array or encodeInto() to write into an existing one.

Last updated

Since
v8.3.0

Syntax

new TextEncoder();
textEncoder.encode([input]);
textEncoder.encodeInto(src, dest);
textEncoder.encoding

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • util.TextDecoder
  • util.toUSVString

Source: Util | Node.js v26.13.0 Documentation. Checked 2026-11-03.