diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-10-21 20:04:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-21 20:04:11 +0800 |
| commit | ab1105c52472946efab9713bf15df45e14ff4514 (patch) | |
| tree | 7af939a22f3efbf055054670ec8d2e3f11a79ad6 /weed/util/bytes.go | |
| parent | 2c40f56e5a2e4792361b6df0bb6e879726f340ab (diff) | |
| parent | 81cf8d04dfcbb84093044de4f10a8a92d9c8bd1c (diff) | |
| download | seaweedfs-ab1105c52472946efab9713bf15df45e14ff4514.tar.xz seaweedfs-ab1105c52472946efab9713bf15df45e14ff4514.zip | |
Merge pull request #31 from chrislusf/master
sync
Diffstat (limited to 'weed/util/bytes.go')
| -rw-r--r-- | weed/util/bytes.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/util/bytes.go b/weed/util/bytes.go index 67e6876fa..c2a4df108 100644 --- a/weed/util/bytes.go +++ b/weed/util/bytes.go @@ -1,6 +1,7 @@ package util import ( + "bytes" "crypto/md5" "crypto/rand" "encoding/base64" @@ -148,3 +149,15 @@ func RandomBytes(byteCount int) []byte { rand.Read(buf) return buf } + +type BytesReader struct { + Bytes []byte + *bytes.Reader +} + +func NewBytesReader(b []byte) *BytesReader { + return &BytesReader{ + Bytes: b, + Reader: bytes.NewReader(b), + } +} |
