mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: depot dodnloader node js
This commit is contained in:
1 parent
3157bc5e1b
commit
d70a980058
4 files changed
+48
-31
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import decompress from 'decompress';
|
||||
import { existsSync } from 'fs';
|
||||
import { mkdir, writeFile } from 'fs/promises';
|
||||
|
||||
if (!existsSync('temp')) {
|
||||
console.log('Creating temp directory...');
|
||||
await mkdir('temp');
|
||||
}
|
||||
|
||||
console.log('Downloading depot downloader...');
|
||||
await fetch(
|
||||
'https://api.github.com/repos/SteamRE/DepotDownloader/releases/latest',
|
||||
)
|
||||
.then(
|
||||
(response) =>
|
||||
response.json() as Promise<{
|
||||
assets: { browser_download_url: string }[];
|
||||
}>,
|
||||
)
|
||||
.then(({ assets }) => fetch(assets[0].browser_download_url))
|
||||
.then((response) => response.arrayBuffer())
|
||||
.then((arrayBuffer) =>
|
||||
writeFile('temp/depotDownloader.zip', Buffer.from(arrayBuffer)),
|
||||
);
|
||||
|
||||
console.log('Unzipping...');
|
||||
decompress('temp/depotDownloader.zip', 'temp/depotDownloader');
|
||||
Reference in new issue
Block a user