Go - Bucket.File.Delete()
Delete a file from a bucket.
import ("context""fmt""github.com/nitrictech/go-sdk/nitric")func main() {bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketDeleting)if err != nil {return}err := bucket.File("cat.png").Delete(context.TODO())if err != nil {return}nitric.Run()}
Parameters
- Name
ctx
- Required
- Required
- Type
- context
- Description
The context of the call, used for tracing.
Examples
Delete a file
import ("context""fmt""github.com/nitrictech/go-sdk/nitric")func main() {bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketDeleting)if err != nil {return}contents, err := bucket.File("cat.png").Delete(context.TODO())if err != nil {return}nitric.Run()}
Last updated on Dec 19, 2024