https://github.com/bandros/awss3
S3 Upload Library
https://github.com/bandros/awss3
aws golang s3
Last synced: 6 months ago
JSON representation
S3 Upload Library
- Host: GitHub
- URL: https://github.com/bandros/awss3
- Owner: bandros
- Created: 2019-02-17T04:27:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T08:28:43.000Z (over 5 years ago)
- Last Synced: 2024-06-21T13:10:50.892Z (about 2 years ago)
- Topics: aws, golang, s3
- Language: Go
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## AWS S3 Library for Go
How to using S3 in AWS
## Upload
file,_ := c.FormFile("file")\
img := awsS3.S3img{}\
img.Width = 200\
img.Prefix = "data_"\
img.AwsRegion = "ap-southeast-1"\
img.AwsKey = "Aws Key"\
img.AwsScreetKey = "Aws Screet Key"\
err := img.SetMulti(file)\
if err != nil {\
fmt.Println("Set Img: ",err.Error())\
return\
}\
location, err := img.Upload("bucket/folder")\
if err != nil {\
fmt.Println("Upload: ",err.Error())\
return\
}\
fmt.Println("Location: ",location)
## Multi Upload
form, _ := c.MultipartForm()\
files := form.File["file[]"]\
img := awsS3.S3img{}\
img.Width = 200\
img.Prefix = "multi_"\
img.AwsRegion = "ap-southeast-1"\
img.AwsKey = "Aws Key"\
img.AwsScreetKey = "Aws Screet Key"\
err := img.SetMulti(files)\
if err != nil {\
fmt.Println("Set Img: ",err.Error())\
return\
}\
location, err := img.Upload("bucket/folder")\
if err != nil {\
fmt.Println("Upload: ",err.Error())\
return\
}\
fmt.Println("Location: ",location)
## List file on Bucket
img := awsS3.S3img{}\
img.AwsRegion = "ap-southeast-1"\
img.AwsKey = "Aws Key"\
img.AwsScreetKey = "Aws Screet Key"\
location, err := img.List("bucket/folder")\
if err != nil {\
fmt.Println(err.Error())\
return\
}\
for _,v := range list {\
if v.IsFolder {\
continue\
}\
fmt.Println(v.File," in ",v.Folder)\
}
## Check File
img := awsS3.S3img{}\
img.AwsRegion = "ap-southeast-1"\
img.AwsKey = "Aws Key"\
img.AwsScreetKey = "Aws Screet Key"\
location, err := img.Exist("bucket/folder")\
if err != nil {\
fmt.Println(err.Error())\
return\
}\
if exist {\
fmt.Println("File exist ")\
}else{\
fmt.Println("File doesn't exist")\
}
**Creator**
https://github.com/tss182