MCPcopy Create free account
hub / github.com/tensorflow/tfjs / decode

Method decode

tfjs-react-native/src/platform_react_native.ts:155–161  ·  view source on GitHub ↗

Decode the provided bytes into a string using the provided encoding.

(bytes: Uint8Array, encoding: string)

Source from the content-addressed store, hash-verified

153 }
154 /** Decode the provided bytes into a string using the provided encoding. */
155 decode(bytes: Uint8Array, encoding: string): string {
156 // See https://www.w3.org/TR/encoding/#utf-16le
157 if (encoding === "utf-16") {
158 encoding = "utf16le";
159 }
160 return Buffer.from(bytes).toString(encoding as BufferEncoding);
161 }
162
163 now(): number {
164 //@ts-ignore

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected