Skip to content

Commit

Permalink
update: use io.Copy instead of io.ReadAll in NewDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
sreeram-narayanan committed Jan 23, 2024
1 parent 966cb87 commit eedd319
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wav/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ type Decoder struct {
}

func NewDecoder(r io.Reader) (*Decoder, error) {
buf, err := io.ReadAll(r)
buf := &bytes.Buffer{}

_, err := io.Copy(buf, r)
if err != nil {
return nil, err
}

d := &Decoder{buffer: buf}
d := &Decoder{buffer: buf.Bytes()}
d.chunks = d.readChunks()

return d, nil
Expand Down

0 comments on commit eedd319

Please sign in to comment.