Add initial SSH/SFTP framework for downloading directories/files

This commit is contained in:
Tony Blyler 2016-05-11 21:39:37 -04:00
parent 3d9fdad416
commit d088e413b7
4 changed files with 260 additions and 0 deletions
metainfo

17
metainfo/metainfo.go Normal file
View file

@ -0,0 +1,17 @@
package metainfo
import (
"github.com/anacrolix/torrent/metainfo"
"io"
"strings"
)
// GetTorrentHashHexString Returns the torrent hash for the given reader
func GetTorrentHashHexString(reader io.Reader) (string, error) {
info, err := metainfo.Load(reader)
if err != nil {
return "", err
}
return strings.ToUpper(info.Info.Hash.HexString()), nil
}