Documentation ¶
Index ¶
- func CheckDirChecksum(root string) (bool, error)
- func IsDirEmpty(path *paths.Path) (bool, error)
- type DownloadResource
- func (r *DownloadResource) ArchivePath(downloadDir *paths.Path) (*paths.Path, error)
- func (r *DownloadResource) Download(downloadDir *paths.Path) (*downloader.Downloader, error)
- func (release *DownloadResource) Install(downloadDir, tempPath, destDir *paths.Path) error
- func (r *DownloadResource) IsCached(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveChecksum(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveIntegrity(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveSize(downloadDir *paths.Path) (bool, error)
- type DownloadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirChecksum ¶
CheckDirChecksum reads checksum from the package.json and compares it with a recomputed value.
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 ¶
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