dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 877e217745b6c480a818e3736d74e9e649be25ed
parent b0514aa7373e278fc5aed490a0314f43ea595998
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri,  3 Feb 2023 17:09:37 -0800

remove readall

Diffstat:
Mcmd/dkfdownload/main.go | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmd/dkfdownload/main.go b/cmd/dkfdownload/main.go @@ -219,10 +219,12 @@ func work(i int, wg *sync.WaitGroup, baseUrl, filedropUUID string, chunksCh chan return err } defer resp.Body.Close() - by, _ := io.ReadAll(resp.Body) - if err := os.WriteFile(filepath.Join(filedropUUID, "part_"+strconv.FormatInt(chunkNum, 10)), by, 0644); err != nil { + f, err := os.OpenFile(filepath.Join(filedropUUID, "part_"+strconv.FormatInt(chunkNum, 10)), os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { return err } + defer f.Close() + _, _ = io.Copy(f, resp.Body) return nil }) newChunksCompleted := atomic.AddInt64(&chunksCompleted, 1)