fix: unzip at root

This commit is contained in:
TrèsAbhi committed 2024-10-21 11:11:25 -05:00
1 parent e40fd2d2b4
commit 2f95c57b7f
4 files changed
+350 -5

No files matched your search

+11 -5
View File
@@ -2,9 +2,9 @@ import decompress from 'decompress';
import { existsSync } from 'fs';
import { mkdir, readdir, writeFile } from 'fs/promises';
if (!existsSync('temp')) {
if (!existsSync('../../temp')) {
console.log('Creating temp directory...');
await mkdir('temp');
await mkdir('../../temp');
}
console.log('Downloading depot downloader...');
@@ -24,10 +24,16 @@ await fetch(
})
.then((response) => response.arrayBuffer())
.then((arrayBuffer) =>
writeFile('temp/depotDownloader.zip', new Uint8Array(arrayBuffer)),
writeFile('../../temp/depotDownloader.zip', new Uint8Array(arrayBuffer)),
);
console.log('Unzipping...');
await decompress('temp/depotDownloader.zip', 'temp/depotDownloader');
await decompress(
'../../temp/depotDownloader.zip',
'../../temp/depotDownloader',
);
console.log('Download complete; files:', await readdir('temp/depotDownloader'));
console.log(
'Download complete; files:',
await readdir('../../temp/depotDownloader'),
);