From 7928b763d98a08f076f829320bfef42c687be77d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 10 Jul 2014 00:15:03 +1000 Subject: [PATCH] torrent-infohash: utility to print the info hash of a torrent file --- cmd/torrent-infohash/main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 cmd/torrent-infohash/main.go diff --git a/cmd/torrent-infohash/main.go b/cmd/torrent-infohash/main.go new file mode 100644 index 00000000..96948d8e --- /dev/null +++ b/cmd/torrent-infohash/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "flag" + "fmt" + "github.com/anacrolix/libtorgo/metainfo" + "log" +) + +func main() { + flag.Parse() + for _, arg := range flag.Args() { + mi, err := metainfo.LoadFromFile(arg) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%x: %s\n", mi.InfoHash, arg) + } +} -- 2.48.1