|
@@ -57,6 +57,17 @@ func LastElem[T any](s []T) T {
|
|
|
return s[len(s)-1]
|
|
|
}
|
|
|
|
|
|
+func MinioObjectExists(minioClient *minio.Client, bucketName string, filePath string) (bool, error) {
|
|
|
+ _, err := minioClient.StatObject(context.Background(), bucketName, filePath, minio.StatObjectOptions{})
|
|
|
+ if err != nil {
|
|
|
+ if minio.ToErrorResponse(err).Code == "NoSuchKey" {
|
|
|
+ return false, nil
|
|
|
+ }
|
|
|
+ return false, fmt.Errorf("stat object failed: %w", err)
|
|
|
+ }
|
|
|
+ return true, nil
|
|
|
+}
|
|
|
+
|
|
|
func MinioUploadFolder(minioClient *minio.Client, bucketName string, objPath string, localPath string) error {
|
|
|
// Walk the local folder
|
|
|
err := filepath.WalkDir(localPath, func(path string, d os.DirEntry, err error) error {
|