// NewFs constructs an Fs from the path, bucket:path
NewFs constructs an Fs from the path, bucket:path
// NewFs constructs an Fs from the path bucket : path
func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
	opt := new(Options)
	err := configstruct.Set(m, opt)
	if err != nil {
		return nil, err
	}
	if opt.ChunkSize < fs.SizeSuffix(s3manager.MinUploadPartSize) {
		return nil, errors.Errorf("s3 chunk size (%v) must be >= %v", opt.ChunkSize, fs.SizeSuffix(s3manager.MinUploadPartSize))
	}
	bucket, directory, err := s3ParsePath(root)
	if err != nil {
		return nil, err
	}
	c, ses, err := s3Connection(opt)
	if err != nil {
		return nil, err
	}
	f := &Fs{
		name:   name,
		root:   directory,
		opt:    *opt,
		c:      c,
		bucket: bucket,
		ses:    ses,
	}
	f.features = (&fs.Features{
		ReadMimeType:  true,
		WriteMimeType: true,
		BucketBased:   true,
	}).Fill(f)
	if f.root != "" {
		f.root += "/"
		req := s3.HeadObjectInput{
			Bucket: &f.bucket,
			Key:    &directory,
		}
		_, err = f.c.HeadObject(&req)
		if err == nil {
			f.root = path.Dir(directory)
			if f.root == "." {
				f.root = ""
			} else {
				f.root += "/"
			}
			return f, fs.ErrorIsFile
		}
	}
	return f, nil
}
func NewFs ( name , root string , m configmap . Mapper ) ( fs . Fs , error ) { opt := new ( Options ) err := configstruct . Set ( m , opt ) if err != nil { return nil , err } if opt . ChunkSize < fs . SizeSuffix ( s3manager . MinUploadPartSize ) { return nil , errors . Errorf ( " " , opt . ChunkSize , fs . SizeSuffix ( s3manager . MinUploadPartSize ) ) } bucket , directory , err := s3ParsePath ( root ) if err != nil { return nil , err } c , ses , err := s3Connection ( opt ) if err != nil { return nil , err } f := & Fs { name : name , root : directory , opt : * opt , c : c , bucket : bucket , ses : ses , } f . features = ( & fs . Features { ReadMimeType : true , WriteMimeType : true , BucketBased : true , } ) . Fill ( f ) if f . root != " " { f . root += " " req := s3 . HeadObjectInput { Bucket : & f . bucket , Key : & directory , } _ , err = f . c . HeadObject ( & req ) if err == nil { f . root = path . Dir ( directory ) if f . root == " " { f . root = " " } else { f . root += " " } return f , fs . ErrorIsFile } } return f , nil }
NewFs constructs an Fs from the path, bucket:path
NewFs constructs an Fs from the path bucket : path
// Parse config into Options struct // Check to see if the object exists // return an error with an fs which points to the parent // f.listMultipartUploads()