Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

fetch-file

Declares one file downloaded to a destination where nothing is.

[[actions]]
type = "fetch-file"
id = "pathogen"
source = "https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim"
dest = "~/.vim/autoload/pathogen.vim"
FieldTypeRequiredDescription
sourcetemplate stringyesAn http://, https://, or file:// URL. Not a repository path.
desttemplate stringyesWhere the file goes, exactly. Never empty; ~ is the home.
sha256template stringno64 hexadecimal digits: the digest the fetched bytes must have.
executablebooleannoWhether the file lands executable. Defaults to false.
decompressbooleannoWhether the download is a gzip or bzip2 stream holding the file. Defaults to false.

The shared transfer, seed, staging, and permission rules apply. An occupied destination costs no transfer unless refresh is requested. On Unix, executable installs the file 0755 rather than 0644.

Without decompress, downloaded bytes are installed unchanged, including any archive. With it, gzip or bzip2 compression is detected from the leading bytes, including concatenated streams, and the decompressed file is installed, as a release publishing tool-linux.gz intends:

[[actions]]
type = "fetch-file"
source = "https://example.com/tool-linux.gz"
dest = "~/.local/bin/tool"
decompress = true
executable = true

Uncompressed data, a zip, or content that decompresses to a tar fails; use fetch-archive for archives. sha256 checks the downloaded bytes before decompression.

With templates, one record can fetch each machine’s build:

[[actions]]
type = "fetch-file"
source = "https://example.com/releases/tool-${facts.os}-${facts.arch}.gz"
dest = "~/.local/bin/tool"
decompress = true
executable = true

See common action fields for id, group, and conditions.