]> Sergey Matveev's repositories - btrtrc.git/blobdiff - example_test.go
Drop support for go 1.20
[btrtrc.git] / example_test.go
index 02655e9596aa7e3ee8da2f3285fd7ea4182205dd..54cb7190689081ac8020a24aeca054897a79ce13 100644 (file)
@@ -7,7 +7,7 @@ import (
 )
 
 func Example() {
-       c, _ := torrent.NewClient(&torrent.Config{})
+       c, _ := torrent.NewClient(nil)
        defer c.Close()
        t, _ := c.AddMagnet("magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU")
        <-t.GotInfo()
@@ -15,3 +15,11 @@ func Example() {
        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()
+}