MCPcopy
hub / github.com/danielmiessler/Fabric / CreateAudioOutputFile

Function CreateAudioOutputFile

internal/cli/output.go:45–64  ·  view source on GitHub ↗

CreateAudioOutputFile creates a binary file for audio data

(audioData []byte, fileName string)

Source from the content-addressed store, hash-verified

43
44// CreateAudioOutputFile creates a binary file for audio data
45func CreateAudioOutputFile(audioData []byte, fileName string) (err error) {
46 // If no extension is provided, default to .wav
47 if filepath.Ext(fileName) == "" {
48 fileName += ".wav"
49 }
50
51 // File existence check is now done in the CLI layer before TTS generation
52 var file *os.File
53 if file, err = os.Create(fileName); err != nil {
54 err = fmt.Errorf(i18n.T("error_creating_audio_file"), err)
55 return
56 }
57 defer file.Close()
58
59 if _, err = file.Write(audioData); err != nil {
60 err = fmt.Errorf(i18n.T("error_writing_audio_data"), err)
61 }
62 // No redundant output message here - the CLI layer handles success messaging
63 return
64}
65
66// IsAudioFormat checks if the filename suggests an audio format
67func IsAudioFormat(fileName string) bool {

Callers 1

handleChatProcessingFunction · 0.85

Calls 2

TFunction · 0.92
CloseMethod · 0.45

Tested by

no test coverage detected