aboutsummaryrefslogtreecommitdiff
path: root/meta/file.go
blob: 35601970759883acfa7386c72011f8a0daf3aff0 (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 int64    `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)
}