mount: shortcut when there is only one chunk

This commit is contained in:
Chris Lu
2020-10-20 23:48:29 -07:00
parent f64252023e
commit c31b254248
3 changed files with 28 additions and 5 deletions

View File

@@ -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),
}
}