add new youtubedl dependency
This commit is contained in:
29
downloader/vendor/github.com/kkdai/youtube/v2/artifacts.go
generated
vendored
Normal file
29
downloader/vendor/github.com/kkdai/youtube/v2/artifacts.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package youtube
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// destination for artifacts, used by integration tests
|
||||
var artifactsFolder = os.Getenv("ARTIFACTS")
|
||||
|
||||
func writeArtifact(name string, content []byte) {
|
||||
// Ensure folder exists
|
||||
err := os.MkdirAll(artifactsFolder, os.ModePerm)
|
||||
if err != nil {
|
||||
slog.Error("unable to create artifacts folder", "path", artifactsFolder, "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
path := filepath.Join(artifactsFolder, name)
|
||||
err = os.WriteFile(path, content, 0600)
|
||||
|
||||
log := slog.With("path", path)
|
||||
if err != nil {
|
||||
log.Error("unable to write artifact", "error", err)
|
||||
} else {
|
||||
log.Debug("artifact created")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user