mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
17 lines
673 B
TypeScript
17 lines
673 B
TypeScript
import { $ } from "bun"
|
|
import path from "path"
|
|
|
|
export namespace Archive {
|
|
export async function extractZip(zipPath: string, destDir: string) {
|
|
if (process.platform === "win32") {
|
|
const winZipPath = path.resolve(zipPath)
|
|
const winDestDir = path.resolve(destDir)
|
|
// $global:ProgressPreference suppresses PowerShell's blue progress bar popup
|
|
const cmd = `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${winZipPath}' -DestinationPath '${winDestDir}' -Force`
|
|
await $`powershell -NoProfile -NonInteractive -Command ${cmd}`.quiet()
|
|
} else {
|
|
await $`unzip -o -q ${zipPath} -d ${destDir}`.quiet()
|
|
}
|
|
}
|
|
}
|