util.TextEncoder 类
WHATWG 编码标准 TextEncoder
API 的实现。
TextEncoder
的所有实例仅支持 UTF-8 编码。
const encoder = new TextEncoder();
const uint8array = encoder.encode('this is some data');
TextEncoder
类也在全局对象上可用。
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');
The TextEncoder
class is also available on the global object.