You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.go 473 B

12345678910111213141516171819202122232425262728
  1. package s3
  2. import (
  3. "encoding/base64"
  4. "fmt"
  5. "path"
  6. )
  7. func DecodeBase64Hash(hash string) ([]byte, error) {
  8. hashBytes := make([]byte, 32)
  9. n, err := base64.RawStdEncoding.Decode(hashBytes, []byte(hash))
  10. if err != nil {
  11. return nil, err
  12. }
  13. if n != 32 {
  14. return nil, fmt.Errorf("invalid hash length: %d", n)
  15. }
  16. return hashBytes, nil
  17. }
  18. func JoinKey(comps ...string) string {
  19. return path.Join(comps...)
  20. }
  21. func BaseKey(key string) string {
  22. return path.Base(key)
  23. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。