// ReadDir reads a current file and returns contents
ReadDir reads a current file and returns contents
// ReadDir reads a current file and returns contents
func (s S3Fs) ReadDir(dirname string) ([]string, error) {
	keys := []string{}
	res, err := s.client.ListObjects(&s3.ListObjectsInput{
		Bucket: aws.String(s.Bucket),
		Prefix: aws.String(dirname),
	})
	if err != nil {
		return nil, err
	}
	for _, obj := range res.Contents {
		keys = append(keys, *obj.Key)
	}
	for res.NextMarker != nil {
		res, err = s.client.ListObjects(&s3.ListObjectsInput{
			Bucket: aws.String(s.Bucket),
			Prefix: aws.String(dirname),
			Marker: res.NextMarker,
		})
		if err != nil {
			return nil, err
		}
		for _, obj := range res.Contents {
			keys = append(keys, *obj.Key)
		}
	}
	return keys, nil
}
func ( s S3Fs ) ReadDir ( dirname string ) ( [ ] string , error ) { keys := [ ] string { } res , err := s . client . ListObjects ( & s3 . ListObjectsInput { Bucket : aws . String ( s . Bucket ) , Prefix : aws . String ( dirname ) , } ) if err != nil { return nil , err } for _ , obj := range res . Contents { keys = append ( keys , * obj . Key ) } for res . NextMarker != nil { res , err = s . client . ListObjects ( & s3 . ListObjectsInput { Bucket : aws . String ( s . Bucket ) , Prefix : aws . String ( dirname ) , Marker : res . NextMarker , } ) if err != nil { return nil , err } for _ , obj := range res . Contents { keys = append ( keys , * obj . Key ) } } return keys , nil }
ReadDir reads a current file and returns contents
ReadDir reads a current file and returns contents