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.encodingIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
util.TextDecoderutil.toUSVString