Go - Bucket.File.UploadUrl()
Create an upload URL for a file within a bucket.
import ("context""fmt""github.com/nitrictech/go-sdk/nitric")func main() {bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketWriting)if err != nil {return}uploadUrl, err := bucket.File("cat.png").UploadUrl(context.TODO(), 600)if err != nil {return}nitric.Run()}
Parameters
- Name
ctx
- Required
- Required
- Type
- context
- Description
The context of the call, used for tracing.
- Name
expiry
- Required
- Required
- Type
- int
- Description
Seconds until link expiry. Maximum of
604800
(7 days).
Examples
Create a temporary file upload link for a user
import ("context""fmt""github.com/nitrictech/go-sdk/nitric")func main() {bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketWriting)if err != nil {return}uploadUrl, err := bucket.File("cat.png").UploadUrl(context.TODO(), 600)if err != nil {return}nitric.Run()}
Last updated on Dec 19, 2024