resources

package
v0.0.0-...-0031c6d Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDirChecksum

func CheckDirChecksum(root string) (bool, error)

CheckDirChecksum reads checksum from the package.json and compares it with a recomputed value.

func IsDirEmpty

func IsDirEmpty(path *paths.Path) (bool, error)

IsDirEmpty returns true if the directory specified by path is empty.

Types

type DownloadResource

type DownloadResource struct {
	URL             string
	ArchiveFileName string
	Checksum        string
	Size            int64
	CachePath       string
}

DownloadResource has all the information to download a file

func (*DownloadResource) ArchivePath

func (r *DownloadResource) ArchivePath(downloadDir *paths.Path) (*paths.Path, error)

ArchivePath returns the path of the Archive of the specified DownloadResource relative to the specified downloadDir

func (*DownloadResource) Download

func (r *DownloadResource) Download(downloadDir *paths.Path) (*downloader.Downloader, error)

Download a DownloadResource.

func (*DownloadResource) Install

func (release *DownloadResource) Install(downloadDir, tempPath, destDir *paths.Path) error

Install installs the resource in three steps: - the archive is unpacked in a temporary subdir of tempPath - there should be only one root dir in the unpacked content - the only root dir is moved/renamed to/as the destination directory Note that tempPath and destDir must be on the same filesystem partition otherwise the last step will fail.

func (*DownloadResource) IsCached

func (r *DownloadResource) IsCached(downloadDir *paths.Path) (bool, error)

IsCached returns true if the specified DownloadResource has already been downloaded

func (*DownloadResource) TestLocalArchiveChecksum

func (r *DownloadResource) TestLocalArchiveChecksum(downloadDir *paths.Path) (bool, error)

TestLocalArchiveChecksum test if the checksum of the local archive match the checksum of the DownloadResource

func (*DownloadResource) TestLocalArchiveIntegrity

func (r *DownloadResource) TestLocalArchiveIntegrity(downloadDir *paths.Path) (bool, error)

TestLocalArchiveIntegrity checks for integrity of the local archive.

func (*DownloadResource) TestLocalArchiveSize

func (r *DownloadResource) TestLocalArchiveSize(downloadDir *paths.Path) (bool, error)

TestLocalArchiveSize test if the local archive size match the DownloadResource size

type DownloadResult

type DownloadResult struct {
	// Error is nil if the download is successful otherwise
	// it contains the reason for the download failure
	Error error

	// AlreadyDownloaded is true if a cache file is found
	// and, consequently, the download has not been executed
	AlreadyDownloaded bool
}

DownloadResult contains the result of a download

Jump to

Keyboard shortcuts

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