MCPcopy
hub / github.com/tensorflow/tfjs-models / arrayBuffer2String

Function arrayBuffer2String

speech-commands/src/generic_utils.ts:73–79  ·  view source on GitHub ↗
(buffer: ArrayBuffer)

Source from the content-addressed store, hash-verified

71
72/** Decode an ArrayBuffer as a string. */
73export function arrayBuffer2String(buffer: ArrayBuffer): string {
74 if (buffer == null) {
75 throw new Error('Received null or undefind buffer');
76 }
77 const buf = new Uint8Array(buffer);
78 return decodeURIComponent(escape(String.fromCharCode(...buf)));
79}
80
81/** Generate a pseudo-random UID. */
82export function getUID(): string {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected