Add initial SSH/SFTP framework for downloading directories/files
This commit is contained in:
parent
3d9fdad416
commit
d088e413b7
4 changed files with 260 additions and 0 deletions
metainfo
17
metainfo/metainfo.go
Normal file
17
metainfo/metainfo.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue