Add creation of audio directory and remove unused function in download package

This commit is contained in:
NeilClack
2026-06-27 14:25:25 -05:00
parent fce5286d86
commit 2c88b7ffc5
5 changed files with 29 additions and 44 deletions
-13
View File
@@ -194,19 +194,6 @@ func fileMD5(path string) (string, error) {
return fmt.Sprintf("%x", h.Sum(nil)), nil
}
// remoteFileSize does a HEAD request and returns Content-Length.
func remoteFileSize(url string) (int64, error) {
resp, err := http.Head(url)
if err != nil {
return 0, err
}
resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return 0, fmt.Errorf("HEAD %s: %s", url, resp.Status)
}
return resp.ContentLength, nil
}
// downloadFile streams url to destPath, calling onChunk(n) after each write
// with the number of bytes just written. Returns total bytes downloaded.
func downloadFile(url, destPath string, onChunk func(int64)) (int64, error) {