Add creation of audio directory and remove unused function in download package
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user