files

package
v0.0.0-...-52a80d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToZip

func AddToZip(zipWriter *zip.Writer, filename string) error

AddToZip writes the given data to a zip archive using the passed writer. Folders are added to the zip recursively. The folder structure is fully preserved.

func DownloadFile

func DownloadFile(filepath, url string) error

DownloadFile will download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory.

func DownloadFileOrAccessCache

func DownloadFileOrAccessCache(filepath, url string) error

DownloadFileOrAccessCache checks whether the file already exists on the users filesystem and only downloads it if it doesn't.

func EnsureDirectoryExists

func EnsureDirectoryExists(directoryPath string) error

EnsureDirectoryExists creates a directy if doesn't already exist. If an error occurs during the existence check, that error is returned directly.

func ToAbsolutePath

func ToAbsolutePath(input string) (string, error)

ToAbsolutePath handles different kind of paths and makes an absolute path out of them. Consider the following three inputs:

	   file:///home/marcel/test.txt%C3%A4
    ./test.txtä
    ~/test.txtä

Those will be turned into (assuming that our current working directory is /home/marcel:

/home/marcel/test.txtä

However, this method doesn't check for file existence.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL