Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tekintian/torrent_convert_utils
A tiny .Torrent file, Magnet link convert utils lib
https://github.com/tekintian/torrent_convert_utils
convert magnet magnet-link torrent torrent-management
Last synced: about 9 hours ago
JSON representation
A tiny .Torrent file, Magnet link convert utils lib
- Host: GitHub
- URL: https://github.com/tekintian/torrent_convert_utils
- Owner: tekintian
- License: other
- Created: 2022-06-26T09:05:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-28T01:26:25.000Z (over 2 years ago)
- Last Synced: 2024-06-21T12:54:52.091Z (5 months ago)
- Topics: convert, magnet, magnet-link, torrent, torrent-management
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# A tiny .Torrent file Magnet convert utils lib
convert torrent file to magnet;
convert magnet to torrent filesupport convert the remote .torrent file to magnet link
## Install
```sh
go get github.com/tekintian/torrent_convert_utils
```## Usage
```go
package demoimport (
btutils "github.com/tekintian/torrent_convert_utils"
)func main(){
//convert local .torrent file to magnet
magnetLink,err:=btutils.TorrentToMagnet("yourpath/youfile.torrent")
fmt.Println(magnetLink)
fmt.Println(err)// convert remote .torrent file to magnet
magnetLink2, err:=btutils.RemoteTorrentToMagnet("http://file.com/youfile.torrent")
fmt.Println(magnetLink2)
fmt.Println(err)// convert magnet link string to torrent file
fileName, err:=btutils.MagnetToTorrent("magnet:?xt=urn:btih:3A5F88EB1F2ECCAEC4424416AC5DCA3B615CE515","public/upload")
fmt.Println(fileName) // your entry file paht is public/upload/{fileName}
fmt.Println(err)}
```