mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix zip utils
This commit is contained in:
3 files changed
+8
-3
No files matched your search
@@ -348,6 +348,8 @@ export async function extractZip<T>(zipOrEntries: ZipReader<T> | Entry[], dest:
|
||||
continue;
|
||||
}
|
||||
if (fs.existsSync(d) && !overwrite) continue;
|
||||
const dir = path.dirname(d);
|
||||
if (!fs.existsSync(dir)) await fs.mkdir(dir, { recursive: true });
|
||||
const content = await entry.getData(Writable.toWeb(fs.createWriteStream(d)), { signal });
|
||||
if (!content) throw new Error('CANT_EXTRACT_FILE');
|
||||
await fs.utimes(d, entry.lastModDate, entry.lastModDate);
|
||||
|
||||
Reference in new issue
Block a user