diff options
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), + } +} |
