2
0
mirror of synced 2025-02-22 21:58:24 +00:00
torrent/example_test.go
Matt Joiner 9b718566ba Add File.NewReader
Fixes #222
2018-01-06 16:37:13 +11:00

26 lines
537 B
Go

package torrent_test
import (
"log"
"github.com/anacrolix/torrent"
)
func Example() {
c, _ := torrent.NewClient(nil)
defer c.Close()
t, _ := c.AddMagnet("magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU")
<-t.GotInfo()
t.DownloadAll()
c.WaitAll()
log.Print("ermahgerd, torrent downloaded")
}
func Example_fileReader() {
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()
}