@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
60 lines (59 loc) • 2.56 kB
TypeScript
import { type SoloLogger } from './logging/solo-logger.js';
export declare class PackageDownloader {
readonly logger?: SoloLogger;
constructor(logger?: SoloLogger);
private resolveTimeout;
private getUrlExistsTimeout;
private getDownloadConnectTimeout;
private getDownloadResponseTimeout;
private isValidURL;
urlExists(url: string): Promise<boolean>;
/**
* Fetch data from a URL and save the output to a file
*
* @param url - source file URL
* @param destinationPath - destination path for the downloaded file
*/
fetchFile(url: string, destinationPath: string): Promise<string>;
/**
* Compute hash of the file contents
* @param filePath - path of the file
* @param [algo] - hash algorithm
* @returns hex digest of the computed hash
* @throws {Error} - if the file cannot be read
*/
private computeFileHash;
/**
* Verifies that the checksum of the sourceFile matches with the contents of the checksumFile
*
* It throws error if the checksum doesn't match.
*
* @param sourceFile - path to the file for which checksum to be computed
* @param checksum - expected checksum
* @param [algo] - hash algorithm to be used to compute checksum
* @returns
* @throws {DataValidationError} - if the checksum doesn't match
*/
private verifyChecksum;
/**
* Fetch a remote package
* @param packageURL
* @param checksumDataOrURL - package checksum URL or checksum data
* @param destinationDirectory - a directory where the files should be downloaded to
* @param verifyChecksum - whether to verify checksum or not
* @param [algo] - checksum algo
* @param [force] - force download even if the file exists in the destinationDirectory
*/
fetchPackage(packageURL: string, checksumDataOrURL: string, destinationDirectory: string, verifyChecksum?: boolean, algo?: string, force?: boolean): Promise<string>;
/**
* Fetch Hedera platform release artifact
*
* It fetches the build.zip file containing the release from a URL like: https://builds.hedera.com/node/software/v0.40/build-v0.40.4.zip
*
* @param tag - full semantic version e.g. v0.40.4
* @param destinationDirectory - directory where the artifact needs to be saved
* @param [force] - whether to download even if the file exists
* @returns full path to the downloaded file
*/
fetchPlatform(tag: string, destinationDirectory: string, force?: boolean): Promise<string>;
}