aboutsummaryrefslogtreecommitdiff
path: root/go/operation/chunked_file.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/operation/chunked_file.go')
-rw-r--r--go/operation/chunked_file.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/go/operation/chunked_file.go b/go/operation/chunked_file.go
index 0e455e93a..33cb25703 100644
--- a/go/operation/chunked_file.go
+++ b/go/operation/chunked_file.go
@@ -30,10 +30,10 @@ type ChunkInfo struct {
type ChunkList []*ChunkInfo
type ChunkManifest struct {
- Name string `json:"name,omitempty"`
- Mime string `json:"mime,omitempty"`
- Size int64 `json:"size,omitempty"`
- Chunks ChunkList `json:"chunks,omitempty"`
+ Name string `json:"name,omitempty"`
+ Mime string `json:"mime,omitempty"`
+ Size int64 `json:"size,omitempty"`
+ Chunks ChunkList `json:"chunks,omitempty"`
}
// seekable chunked file reader
@@ -50,7 +50,13 @@ func (s ChunkList) Len() int { return len(s) }
func (s ChunkList) Less(i, j int) bool { return s[i].Offset < s[j].Offset }
func (s ChunkList) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func LoadChunkedManifest(buffer []byte) (*ChunkManifest, error) {
+func LoadChunkManifest(buffer []byte, isGzipped bool) (*ChunkManifest, error) {
+ if isGzipped {
+ var err error
+ if buffer, err = UnGzipData(buffer); err != nil {
+ return nil, err
+ }
+ }
cm := ChunkManifest{}
if e := json.Unmarshal(buffer, &cm); e != nil {
return nil, e