The Go SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Go - Bucket.File()
Create a reference to a file within a bucket.
import (
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
bucket, err := nitric.NewBucket("bucket-name").Allow(nitric.BucketRead)
if err != nil {
return
}
file := bucket.File("cat.png")
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}
Parameters
- Name
name
- Required
- Required
- Type
- string
- Description
The unique name/reference to the file.
Notes
The file does not need to exist, only a reference to that file is being created.