func NewFile(rawurl string, c *Config) (*File, error) {
	u, err := url.Parse(rawurl)
	if err != nil {
		return nil, err
	}
	if u.RawQuery != "" {
		return nil, errors.New("url cannot have raw query parameters.")
	}
	if u.Fragment != "" {
		return nil, errors.New("url cannot have a fragment.")
	}

	prefix := strings.TrimLeft(u.Path, "/")
	if prefix != "" && !strings.HasSuffix(prefix, "/") {
		prefix += "/"
	}
	u.Path = ""
	return &File{u.String(), prefix, c, nil}, nil
}
func NewFile(rawurl string, c *Config) (*File, error) {
	u, err := url.Parse(rawurl)
	if err != nil {
		return nil, err
	}
	if u.RawQuery != "" {
		return nil, errors.New("url cannot have raw query parameters.")
	}
	if u.Fragment != "" {
		return nil, errors.New("url cannot have a fragment.")
	}

	prefix := strings.TrimLeft(u.Path, "/")
	if prefix != "" && !strings.HasSuffix(prefix, "/") {
		prefix += "/"
	}
	u.Path = ""
	return &File{u.String(), prefix, c, nil}, nil
}
// NewFile returns a new File with the given URL and config.
//
// Set rawurl to a directory on S3, such as
// https://mybucket.s3.amazonaws.com/myfolder.
// The URL cannot have query parameters or a fragment.
// If c is nil, DefaultConfig will be used.