Skip to content

Commit

Permalink
Buffer metainfo loads from files
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Sep 16, 2023
1 parent 4fb12d0 commit b84b19c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metainfo/metainfo.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package metainfo

import (
"bufio"
"io"
"net/url"
"os"
Expand Down Expand Up @@ -43,7 +44,9 @@ func LoadFromFile(filename string) (*MetaInfo, error) {
return nil, err
}
defer f.Close()
return Load(f)
var buf bufio.Reader
buf.Reset(f)
return Load(&buf)
}

func (mi MetaInfo) UnmarshalInfo() (info Info, err error) {
Expand Down

0 comments on commit b84b19c

Please sign in to comment.