类:util.TextEncoder
【Class: util.TextEncoder】
WHATWG 编码标准 TextEncoder API 的一个实现。所有 TextEncoder 实例只支持 UTF-8 编码。
【An implementation of the WHATWG Encoding Standard TextEncoder API. All
instances of TextEncoder only support UTF-8 encoding.】
const encoder = new TextEncoder();
const uint8array = encoder.encode('this is some data'); TextEncoder 类也可以在全局对象上使用。
【The TextEncoder class is also available on the global object.】