MCPcopy Index your code
hub / github.com/tensorflow/tfjs / encode

Method encode

tfjs-core/src/platforms/platform_node.ts:69–75  ·  view source on GitHub ↗
(text: string, encoding: string)

Source from the content-addressed store, hash-verified

67 }
68
69 encode(text: string, encoding: string): Uint8Array {
70 if (encoding !== 'utf-8' && encoding !== 'utf8') {
71 throw new Error(
72 `Node built-in encoder only supports utf-8, but got ${encoding}`);
73 }
74 return this.textEncoder.encode(text);
75 }
76 decode(bytes: Uint8Array, encoding: string): string {
77 if (bytes.length === 0) {
78 return '';

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.65

Tested by

no test coverage detected