```
func ListObj() (fileInfo []ObjectType) {
fileInfo = make([]ObjectType, 0)
objectCh := client.ListObjects(context.Background(), "cloud", minio.ListObjectsOptions{
Recursive: true,
})
for fileObjects := range objectCh {
if fileObjects.Err != nil {
log.Println(fileObjects.Err)
return nil
}
fileInfo = append(fileInfo, ObjectType{
FileName: fileObjects.Key,
FileType: fileObjects.ContentType,
})
fmt.Printf("文件名:%s 文件类型:%s\n", fileObjects.Key,fileObjects.ContentType)
}
return fileInfo
}
```
在调用fileObjects.ContentType的时候无法获取到ContentType的类型,请帮忙给指点一下谢谢
已经解决了:
调用fileObjects.UserMetadata["content-type"]
有疑问加站长微信联系(非本文作者)