Documentation ¶
Index ¶
- Constants
- type EmbeddedFile
- type File
- func (f *File) EmbeddedFiles() []os.FileInfo
- func (f *File) LengthOf(index int) int
- func (f *File) OffsetOf(index int) int64
- func (f *File) Open(name string) (fs.File, error)
- func (f *File) PieceCount() int
- func (f *File) Size() int64
- func (f *File) StoragePath() string
- func (f *File) Validate(index int, buffer []byte) bool
- type InfoHash
Constants ¶
const DownloadExt = ".tordata"
DownloadExt is the extension used for the torrent download data file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbeddedFile ¶
type EmbeddedFile struct { Name string Dir string Length int64 // contains filtered or unexported fields }
EmbeddedFile represents a file embedded in torrent file storage.
func (*EmbeddedFile) Close ¶
func (ef *EmbeddedFile) Close() error
Close the file. May be called more than once.
func (*EmbeddedFile) Open ¶
func (ef *EmbeddedFile) Open() (*io.SectionReader, error)
Open the file for reading.
type File ¶
type File struct { Path string `bencode:"-"` Announce string `bencode:"announce"` Info struct { Name string `bencode:"name"` PieceLength int `bencode:"piece length"` Pieces []byte `bencode:"pieces"` Length int64 `bencode:"length,omitempty"` Files []struct { Length int64 `bencode:"length"` Path []string `bencode:"path"` } `bencode:"files,omitempty"` Private bool `bencode:"private"` } `bencode:"info"` InfoHash InfoHash `bencode:"-"` // contains filtered or unexported fields }
File holds the contents of a .torrent file.
func NewFileFromBytes ¶
NewFileFromBytes creates a torrent file structure from the raw torrent file data.
func NewFileFromPath ¶
NewFileFromPath creates a torrent file structure from the raw torrent file data.
func NewFileFromReader ¶
NewFileFromReader creates a torrent file structure from the raw torrent file data.
func (*File) EmbeddedFiles ¶
EmbeddedFiles returns the files embedded in the torrent file. This should only be used after a torrent has completely downloaded.
func (*File) OffsetOf ¶
OffsetOf returns the offset into the data for the piece at the specified index.
func (*File) StoragePath ¶
StoragePath returns the path that will be used for torrent file storage.