Feat: List files in COS bucket

This commit is contained in:
HFO4
2020-04-29 10:36:52 +08:00
parent 305497e7cb
commit cfaf20926f
2 changed files with 85 additions and 8 deletions

View File

@@ -110,15 +110,19 @@ func (handler Driver) List(ctx context.Context, base string, recursive bool) ([]
// 列取文件
base = strings.TrimPrefix(base, "/")
delimiter := ""
if base != "" {
base += "/"
}
var (
delimiter string
marker string
objects []oss.ObjectProperties
commons []string
)
if !recursive {
delimiter = "/"
}
marker := ""
var (
objects []oss.ObjectProperties
commons []string
)
for {
subRes, err := handler.bucket.ListObjects(oss.Marker(marker), oss.Prefix(base),