mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
zip download
This commit is contained in:
1 parent
d3202e8607
commit
4d0f21e10b
1 file changed
+9
-2
@@ -1,6 +1,6 @@
|
|||||||
import { assertSecret } from "@blitzkit/core";
|
import { assertSecret } from "@blitzkit/core";
|
||||||
import { $ } from "bun";
|
import { $ } from "bun";
|
||||||
import { rm } from "node:fs/promises";
|
import { mkdir, rm } from "node:fs/promises";
|
||||||
import {
|
import {
|
||||||
DEPOT_DOWNLOADER_EXECUTABLE,
|
DEPOT_DOWNLOADER_EXECUTABLE,
|
||||||
DEPOT_DOWNLOADER_MAX_DOWNLOADS,
|
DEPOT_DOWNLOADER_MAX_DOWNLOADS,
|
||||||
@@ -12,6 +12,8 @@ const provider = assertSecret(import.meta.env.CLIENT_PROVIDER);
|
|||||||
const source = assertSecret(import.meta.env.CLIENT_SOURCE);
|
const source = assertSecret(import.meta.env.CLIENT_SOURCE);
|
||||||
const dir = assertSecret(import.meta.env.CLIENT_DIR);
|
const dir = assertSecret(import.meta.env.CLIENT_DIR);
|
||||||
|
|
||||||
|
await rm(dir, { recursive: true, force: true });
|
||||||
|
|
||||||
if (provider === "steam") {
|
if (provider === "steam") {
|
||||||
const [id, platform] = source.split("/");
|
const [id, platform] = source.split("/");
|
||||||
|
|
||||||
@@ -28,7 +30,6 @@ if (provider === "steam") {
|
|||||||
throw new Error("No linux-x64 asset found for Steam DepotDownloader");
|
throw new Error("No linux-x64 asset found for Steam DepotDownloader");
|
||||||
}
|
}
|
||||||
|
|
||||||
await rm(dir, { recursive: true, force: true });
|
|
||||||
await rm(DEPOT_DOWNLOADER_OUTPUT, { recursive: true, force: true });
|
await rm(DEPOT_DOWNLOADER_OUTPUT, { recursive: true, force: true });
|
||||||
|
|
||||||
await $`curl -L "${asset.browser_download_url}" -o "${DEPOT_DOWNLOADER_OUTPUT}.zip"`;
|
await $`curl -L "${asset.browser_download_url}" -o "${DEPOT_DOWNLOADER_OUTPUT}.zip"`;
|
||||||
@@ -45,6 +46,12 @@ if (provider === "steam") {
|
|||||||
} -app ${id} -username ${username} -password ${
|
} -app ${id} -username ${username} -password ${
|
||||||
password
|
password
|
||||||
} -dir ${dir} -max-downloads ${DEPOT_DOWNLOADER_MAX_DOWNLOADS}`;
|
} -dir ${dir} -max-downloads ${DEPOT_DOWNLOADER_MAX_DOWNLOADS}`;
|
||||||
|
} else if (provider === "zip") {
|
||||||
|
const url = assertSecret(import.meta.env.CLIENT_SOURCE);
|
||||||
|
|
||||||
|
await mkdir(dir, { recursive: true });
|
||||||
|
|
||||||
|
await $`curl -L "${url}" | bsdtar -xf- --strip-components=1 -C ${dir}`;
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown provider: ${provider}`);
|
throw new Error(`Unknown provider: ${provider}`);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user