fix: support downloading raw binaries

This commit is contained in:
Amin Yahyaabadi 2021-09-14 04:27:55 -05:00
parent e77708aa48
commit b957bc4ab8
1 changed files with 4 additions and 4 deletions

View File

@ -7,14 +7,14 @@ import { tmpdir } from "os"
/** A type that describes a package */
export type PackageInfo = {
/** url to download the package */
/** Url to download the package */
url: string
/** The top folder name once it is extracted. It can be `""` if there is no top folder */
extractedFolderName: string
/** The relative directory in which the binary is located. It can be `""` if the exe is in the top folder */
binRelativeDir: string
/** the function to extract the downloaded archive */
extractFunction: {
/** The function to extract the downloaded archive. It can be `undefined`, if the binary itself is downloaded directly. */
extractFunction?: {
(url: string, outputPath: string): Promise<string>
}
}
@ -47,7 +47,7 @@ export async function setupBin(
if (!existsSync(workDir)) {
await group(`Download and extract ${name}`, async () => {
const downloaded = await downloadTool(url)
await extractFunction(downloaded, workDir)
await extractFunction?.(downloaded, workDir)
})
}