aboutsummaryrefslogtreecommitdiff
path: root/meta/file.go
blob: 8a5a38250113ab17d4e83623e1e36818af7ba7c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package meta

import (
	"fmt"
	"path"
)

type File struct {
	Length int      `bencode:"length"`
	MD5Sum []byte   `bencode:"md5sum,optional"` // never seen in wildlife
	Path   []string `bencode:"path"`
}

func (f File) Name() string {
	return path.Join(f.Path...)
}

func (f File) String() string {
	return fmt.Sprintf("%v (%d)", f.Name(), f.Length)
}