package torrent_test
import (
- "io"
"log"
"github.com/anacrolix/torrent"
}
func Example_fileReader() {
- var (
- t torrent.Torrent
- f torrent.File
- )
- r := t.NewReader()
- defer r.Close()
- // Access the parts of the torrent pertaining to f. Data will be
+ var f torrent.File
+ // Accesses the parts of the torrent pertaining to f. Data will be
// downloaded as required, per the configuration of the torrent.Reader.
- _ = io.NewSectionReader(r, f.Offset(), f.Length())
+ r := f.NewReader()
+ defer r.Close()
}