Skip to content

sysadmin.downloader #

fn download #

fn download(args_ DownloadArgs) !DownloadMeta

downoads url specified dir or file . url can be ssh:// http(s):// git:// or just a path to a directory linked to a circle '${runner.root}/circles/${circlename}/downloads/${args.name}' . will return DownloadMeta, which is als json serialized in above directory . if dest specified will link to the dest or copy depending param:destlink

fn getlastname #

fn getlastname(url string) string

enum DownloadType #

enum DownloadType {
	unknown
	git
	ssh
	pathdir
	pathfile
	httpfile
}

struct DownloadArgs #

@[params]
struct DownloadArgs {
pub mut:
	name         string // name of the download, if not specified then last part  of url
	downloadpath string // the directory or file where we will download, will be /tmp/downloads/$name
	url          string // url can be ssh:// http(s):// git:// file:// http(s)file:// or just a path
	reset        bool   // to remove all changes
	gitpull      bool   // if you want to force to pull the information
	minsize_kb   u32    // is always in kb
	maxsize_kb   u32
	dest         string // if the dir or file needs to be copied somewhere
	destlink     bool = true // if bool then will link the downloaded content to the dest
	hash         string // if specified then will check the hash of the downloaded content
	metapath     string // if not specified then will not write
	gitstructure ?gittools.GitStructure @[skip; str: skip]
	expand       bool
}

struct DownloadMeta #

struct DownloadMeta {
pub mut:
	args         DownloadArgs
	size_kb      u32
	hash         string
	downloadtype DownloadType
	path         string
}