Skip to content

Commit

Permalink
refactor: add helper for writing content to archive file
Browse files Browse the repository at this point in the history
  • Loading branch information
ybirader committed Aug 12, 2023
1 parent 0028836 commit 8054200
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (a *Archiver) WriteFile(path string, info fs.FileInfo) error {
return err
}

_, err = io.Copy(writer, file)
err = a.writeContents(writer, file)
if err != nil {
return err
}
Expand All @@ -104,5 +104,14 @@ func (a *Archiver) createFile(info fs.FileInfo) (io.Writer, error) {
return writer, nil
}

func (a *Archiver) writeContents(w io.Writer, r io.Reader) error {
_, err := io.Copy(w, r)
if err != nil {
return err
}

return nil
}

func main() {
}

0 comments on commit 8054200

Please sign in to comment.