package torrent_test
import (
- "io"
"log"
"github.com/anacrolix/torrent"
}
func Example_fileReader() {
- var (
- t torrent.Torrent
- f torrent.File
- )
- r := t.NewReader()
+ 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.
+ r := f.NewReader()
defer r.Close()
- _ = io.NewSectionReader(r, f.Offset(), f.Length())
- // fr will read from the parts of the torrent pertaining to f.
}