mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 16:22:52 +08:00
Typo
This commit is contained in:
15
s3/README.md
15
s3/README.md
@@ -31,6 +31,11 @@ func (s *Storage) Delete(key string) error
|
|||||||
func (s *Storage) Reset() error
|
func (s *Storage) Reset() error
|
||||||
func (s *Storage) Close() error
|
func (s *Storage) Close() error
|
||||||
func (s *Storage) Conn() *s3.Client
|
func (s *Storage) Conn() *s3.Client
|
||||||
|
|
||||||
|
// Additional useful methods.
|
||||||
|
func (s *Storage) CreateBucker(bucket string) error
|
||||||
|
func (s *Storage) DeleteBucket(bucket string) error
|
||||||
|
func (s *Storage) SetWithChecksum(key string, val []byte, checksum map[types.ChecksumAlgorithm][]byte) error
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
@@ -83,15 +88,19 @@ ask S3 server to verify data integrity on server side:
|
|||||||
> For more information, see [PutObjectInput](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/s3#PutObjectInput).
|
> For more information, see [PutObjectInput](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/s3#PutObjectInput).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
key := "my-key"
|
||||||
val := []byte("my-value")
|
val := []byte("my-value")
|
||||||
sha256sum := sha256.New().Sum256(val)
|
|
||||||
|
hash := sha256.New()
|
||||||
|
hash.Write(val)
|
||||||
|
sha256sum := hash.Sum(nil)
|
||||||
|
|
||||||
// import "github.com/aws/aws-sdk-go-v2/service/s3/types"
|
// import "github.com/aws/aws-sdk-go-v2/service/s3/types"
|
||||||
checksum = map[types.ChecksumAlgorithm][]byte{
|
checksum = map[types.ChecksumAlgorithm][]byte{
|
||||||
types.ChecksumAlgorithmSha256: sha256sum,
|
types.ChecksumAlgorithmSha256: sha256sum,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := store.SetWithChecksum("my-key", []byte("my-value"), checksum)
|
err := store.SetWithChecksum(key, val, checksum)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Config
|
### Config
|
||||||
@@ -136,7 +145,9 @@ type Credentials struct {
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Default Config
|
### Default Config
|
||||||
|
|
||||||
The default configuration lacks Bucket, Region, and Endpoint which are all required and must be overwritten:
|
The default configuration lacks Bucket, Region, and Endpoint which are all required and must be overwritten:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// ConfigDefault is the default config
|
// ConfigDefault is the default config
|
||||||
var ConfigDefault = Config{
|
var ConfigDefault = Config{
|
||||||
|
@@ -24,6 +24,7 @@ func (s *Storage) CreateBucket(bucket string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteBucket deletes a bucket.
|
||||||
func (s *Storage) DeleteBucket(bucket string) error {
|
func (s *Storage) DeleteBucket(bucket string) error {
|
||||||
ctx, cancel := s.requestContext()
|
ctx, cancel := s.requestContext()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
Reference in New Issue
Block a user