export async function cacheFile()

in tool.ts [333:360]


export async function cacheFile(sourceFile: string,
    targetFile: string,
    tool: string,
    version: string,
    arch?: string): Promise<string> {
    version = semver.clean(version);
    arch = arch || os.arch();
    console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch));

    tl.debug('source file:' + sourceFile);
    if (!tl.stats(sourceFile).isFile()) {
        throw new Error('sourceFile is not a file');
    }

    // create the tool dir
    let destFolder: string = _createToolPath(tool, version, arch);

    // copy instead of move. move can fail on Windows due to
    // anti-virus software having an open handle on a file.
    let destPath: string = path.join(destFolder, targetFile);
    tl.debug('destination file' + destPath);
    tl.cp(sourceFile, destPath);

    // write .complete
    _completeToolPath(tool, version, arch);

    return destFolder;
}