btutils

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 11 Imported by: 0

README

A tiny .Torrent file Magnet convert utils lib

convert torrent file to magnet; convert magnet to torrent file

support convert the remote .torrent file to magnet link

Install

go get github.com/tekintian/torrent_convert_utils

Usage

package demo

import (
	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)

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMagnetLinkFromTReader

func GetMagnetLinkFromTReader(r io.Reader) (string, error)

get magnet link string from torrent io reader

func MagnetToTorrent

func MagnetToTorrent(magnetLink string, savePath string) (fileName string, err error)

convert magnet link to torrent file

func RemoteTorrentToMagnet

func RemoteTorrentToMagnet(torrentUrl string) (string, error)

remote torrent url to magnet

func TorrentToMagnet

func TorrentToMagnet(torrentFile string) (string, error)

convert torrent file to magent string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL