Documentation ¶
Overview ¶
Package util contains varoius utilities used by MCPM
Index ¶
- func DownloadPackage(typ int, pid int, name string, fid int) (string, io.ReadCloser, error)
- func DownloadPackageInfo(typ int, pid int, name string) (io.ReadCloser, error)
- func FileSize(size int64) string
- func FindGo() error
- func FindJava() error
- func GetHomeDir() string
- func MkDirIfNotExist(dir string) error
- func Must(e error)
- func MustClose(cl io.Closer)
- func ReadGobGzip(file string, v interface{}) error
- func WriteGobGzip(file string, v interface{}) error
- type PackageOptions
- type ProgressReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadPackage ¶
DownloadPackage allows to download packages. If File ID (fid) equals -1, then it downloads the latest version.
func DownloadPackageInfo ¶
DownloadPackageInfo allows to download information about packages.
func GetHomeDir ¶
func GetHomeDir() string
GetHomeDir returns default MCPM directory. If directory is not set yet, function creates a path to it and checks if it exists.
func MkDirIfNotExist ¶
MkDirIfNotExist checks if a directory exists. If not, it creates one.
func ReadGobGzip ¶
ReadGobGzip reads gzipped and encoded with gob data from a file and decodes it.
func WriteGobGzip ¶
WriteGobGzip writes gzipped and encoded with gob data to a file.
Types ¶
type PackageOptions ¶
func GetPackageOptions ¶
func GetPackageOptions(typ int) *PackageOptions
type ProgressReader ¶
type ProgressReader struct {
// contains filtered or unexported fields
}
ProgressReader is an io.ReadCloser which outputs progress in a terminal.
func NewProgressReader ¶
func NewProgressReader(r io.Reader, total uint64, intro string) *ProgressReader
NewProgressReader returns new ProgressReader.
func (*ProgressReader) Close ¶
func (pr *ProgressReader) Close() error
Close checks if given io.Reader is also an io.Closer. If true, it closes.