fix: check dir exists

This commit is contained in:
tresabhi committed 2025-01-17 20:15:09 -06:00
1 parent 7027f63236
commit 0ae59c2fd7
1 file changed
+6 -1
+6 -1
View File
@@ -1,4 +1,5 @@
import { assertSecret } from '@blitzkit/core';
import { existsSync } from 'fs';
import { mkdir, writeFile } from 'fs/promises';
import { parse as parsePath } from 'path';
import ProgressBar from 'progress';
@@ -48,8 +49,12 @@ while (true) {
await Promise.all(
files.map(async ({ path, data }) => {
const { dir } = parsePath(path);
const dirPath = `${DATA}/${dir}`;
if (!existsSync(dirPath)) {
await mkdir(dirPath, { recursive: true });
}
await mkdir(`${DATA}/${dir}`, { recursive: true });
await writeFile(
`${DATA}/${path}`,
new Uint8Array(writeDVPL(Buffer.from(data))),