Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Jul 23, 2024
1 parent 4419e8f commit 65233f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/massalabs/DeWeb

go 1.22
go 1.22
5 changes: 2 additions & 3 deletions int/zipper/zipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"io"
)


func GetZipFileContent(z *zip.File) ([]byte, error) {
file, err := z.Open()
file, err := z.Open()
if err != nil {
return nil, fmt.Errorf("opening zip content: %w", err)
}
Expand All @@ -20,4 +19,4 @@ file, err := z.Open()
}

return content, nil
}
}
8 changes: 2 additions & 6 deletions utils/chunker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ package chunker
// Max ChunkSize is half a mb (512kb)
const ChunkSize = 512


func DivideChunk(data []byte) [][]byte {
counter := 0

chunkNumber := len(data)/ChunkSize + 1

var chunks [][]byte

for i := 1; i < chunkNumber; i++ {
counter += ChunkSize
chunks = append(chunks, data[(i-1)*ChunkSize:(i)*ChunkSize])
}

chunks = append(chunks, data[(chunkNumber-1)*ChunkSize:])

return chunks
}
}

0 comments on commit 65233f0

Please sign in to comment.