// directories that need to be created for all the items in the artifact
directoryStructure: string[]
// individual files that need to be downloaded as part of the artifact
filesToDownload: DownloadItem[]
}
exportinterfaceDownloadItem{
// Url that denotes where to download the item from
sourceLocation: string
// Information about where the file should be downloaded to
targetPath: string
}
/**
* Creates a specification for a set of files that will be downloaded
* @param artifactName the name of the artifact
* @param artifactEntries a set of container entries that describe that files that make up an artifact
* @param downloadPath the path where the artifact will be downloaded to
* @param includeRootDirectory specifies if there should be an extra directory (denoted by the artifact name) where the artifact files should be downloaded to
*/
exportfunctiongetDownloadSpecification(
artifactName: string,
artifactEntries: ContainerEntry[],
downloadPath: string,
includeRootDirectory: boolean
):DownloadSpecification{
constdirectories=newSet<string>()
constspecifications: DownloadSpecification={
rootDownloadLocation: includeRootDirectory
?path.join(downloadPath,artifactName)
:downloadPath,
directoryStructure:[],
filesToDownload:[]
}
for(constentryofartifactEntries){
// Ignore artifacts in the container that don't begin with the same name