mirror of
https://github.com/PretendoNetwork/super-mario-maker.git
synced 2026-04-26 02:01:41 -05:00
forgot to commit new utility method
This commit is contained in:
parent
d80ba5ed3b
commit
634e4d1062
15
utility.go
15
utility.go
|
|
@ -6,6 +6,8 @@ import (
|
|||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
nexproto "github.com/PretendoNetwork/nex-protocols-go"
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
|
|
@ -174,3 +176,16 @@ func userNotOwnCourse(courseID uint64, pid uint32) bool {
|
|||
|
||||
return courseMetadata.OwnerPID != pid
|
||||
}
|
||||
|
||||
func s3ObjectSize(bucket, key string) (uint64, error) {
|
||||
headObj := s3.HeadObjectInput{
|
||||
Bucket: aws.String(bucket),
|
||||
Key: aws.String(key),
|
||||
}
|
||||
result, err := s3Client.HeadObject(&headObj)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return uint64(aws.Int64Value(result.ContentLength)), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user