List returns a flat list with info for all files under the specified prefix.
(prefix string)
| 176 | |
| 177 | // List returns a flat list with info for all files under the specified prefix. |
| 178 | func (s *System) List(prefix string) ([]*blob.ListObject, error) { |
| 179 | files := []*blob.ListObject{} |
| 180 | |
| 181 | iter := s.bucket.List(&blob.ListOptions{ |
| 182 | Prefix: prefix, |
| 183 | }) |
| 184 | |
| 185 | for { |
| 186 | obj, err := iter.Next(s.ctx) |
| 187 | if err != nil { |
| 188 | if !errors.Is(err, io.EOF) { |
| 189 | return nil, err |
| 190 | } |
| 191 | break |
| 192 | } |
| 193 | files = append(files, obj) |
| 194 | } |
| 195 | |
| 196 | return files, nil |
| 197 | } |
| 198 | |
| 199 | // Upload writes content into the fileKey location. |
| 200 | func (s *System) Upload(content []byte, fileKey string) error { |