MCPcopy Create free account
hub / github.com/cactus-compute/cactus-react-native / readAudioFile

Function readAudioFile

example/src/StreamSTTScreen.tsx:46–55  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

44 };
45
46 const readAudioFile = async (filePath: string): Promise<Uint8Array> => {
47 const base64Audio = await RNFS.readFile(filePath, 'base64');
48 const binaryString = atob(base64Audio);
49 const bytes = new Uint8Array(binaryString.length);
50 for (let i = 0; i < binaryString.length; i++) {
51 bytes[i] = binaryString.charCodeAt(i);
52 }
53 // Skip WAV header (44 bytes)
54 return bytes.slice(44);
55 };
56
57 const handleStreamTranscribe = async () => {
58 if (!audioFile) return;

Callers 1

handleStreamTranscribeFunction · 0.85

Calls 1

readFileMethod · 0.65

Tested by

no test coverage detected