Загрузка файла Golang minio
Copy
file, err := os.Open("my-testfile")
if err != nil {
fmt.Println(err)
return
}
defer file.Close()
fileStat, err := file.Stat()
if err != nil {
fmt.Println(err)
return
}
uploadInfo, err := minioClient.PutObject(context.Background(), "mybucket", "myobject", file, fileStat.Size(), minio.PutObjectOptions{ContentType:"application/octet-stream"})
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Successfully uploaded bytes: ", uploadInfo)
Lovely Loris