本文整理汇总了TypeScript中util.TextEncoder类的典型用法代码示例。如果您正苦于以下问题:TypeScript TextEncoder类的具体用法?TypeScript TextEncoder怎么用?TypeScript TextEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEncoder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Int32Array
td.decode(new Int32Array(1));
td.decode(new Uint8Array(1));
td.decode(new Uint16Array(1));
td.decode(new Uint32Array(1));
td.decode(new Uint8ClampedArray(1));
td.decode(new Float32Array(1));
td.decode(new Float64Array(1));
td.decode(new DataView(new Int8Array(1).buffer));
td.decode(new ArrayBuffer(1));
td.decode(null);
td.decode(null, { stream: true });
td.decode(new Int8Array(1), { stream: true });
const decode: string = td.decode(new Int8Array(1));
// util.TextEncoder()
const te = new util.TextEncoder();
const teEncoding: string = te.encoding;
const teEncodeRes: Uint8Array = te.encode("TextEncoder");
// util.types
let b: boolean;
b = util.types.isBigInt64Array(15);
b = util.types.isBigUint64Array(15);
b = util.types.isModuleNamespaceObject(15);
// tslint:disable-next-line:no-construct ban-types
const maybeBoxed: number | Number = new Number(1);
if (util.types.isBoxedPrimitive(maybeBoxed)) {
const boxed: Number = maybeBoxed;
}
const maybeBoxed2: number | Number = 1;
示例2: encode
public async encode(input: string) {
return transferInto(this.te.encode(input))
}