mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: check dir exists
This commit is contained in:
1 parent
7027f63236
commit
0ae59c2fd7
1 file changed
+6
-1
@@ -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))),
|
||||
|
||||
Reference in new issue
Block a user