2
0
mirror of synced 2025-02-23 14:18:13 +00:00
torrent/example_test.go
Matt Joiner 7f8ce59e39 Make the package example an actual example.
I can't remember who had this great suggestion.
2015-05-24 21:36:24 +10:00

18 lines
322 B
Go

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