Example for GO

Installing

go get github.com/aws/aws-sdk-go-v2/aws

Example

init s3 client

func main()  {
	var key, secret, token, endpoint string
	cfg, err := config.LoadDefaultConfig(context.TODO(),
		config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(key, secret, token)),
		config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
			return aws.Endpoint{
				URL: endpoint,
			}, nil
		})),
	)
	if err != nil {
		log.Fatalf("unable to load SDK config, %v", err)
	}
	client := s3.NewFromConfig(cfg)
}

create bucket and put object

list buckets and list objects

Get ipfs hash and arweave hash

If you have any questions, please join our Discord server, or send us an email at [email protected].

Last updated