util: DoChunks: accept custom chunk sizes
This commit is contained in:
parent
f02730dc6b
commit
06f296639e
2 changed files with 3 additions and 3 deletions
|
|
@ -39,11 +39,11 @@ func Dirents(dir string) (entries []string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func DoChunks(f io.Reader, fun func (buf []byte)) (err error) {
|
||||
func DoChunks(f io.Reader, kib uint, fun func (buf []byte)) (err error) {
|
||||
err = nil
|
||||
bytes, chunks := int64(0), int64(0)
|
||||
r := bufio.NewReader(f)
|
||||
buf := make([]byte, 0, 4*1024)
|
||||
buf := make([]byte, 0, kib * 1024)
|
||||
|
||||
for {
|
||||
var n int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue