示例#1
0
func (file *File) DownloadURL() string {
	if file.URL != "" {
		return file.URL
	}

	url, _ := utils.S3SignedUrl(file.Key(), -1)
	return url
}
示例#2
0
func (file *File) Presign() {

	if file.URL == "" {
		url, expiration := utils.S3SignedUrl(file.Key(), -1)
		file.PresignedURL = url
		file.PresignedExpiration = expiration
	} else {
		file.PresignedURL = file.URL
		t := time.Now()
		file.PresignedExpiration = t.Unix() + (60 * 60)
	}

}