mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +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 { assertSecret } from '@blitzkit/core';
|
||||||
|
import { existsSync } from 'fs';
|
||||||
import { mkdir, writeFile } from 'fs/promises';
|
import { mkdir, writeFile } from 'fs/promises';
|
||||||
import { parse as parsePath } from 'path';
|
import { parse as parsePath } from 'path';
|
||||||
import ProgressBar from 'progress';
|
import ProgressBar from 'progress';
|
||||||
@@ -48,8 +49,12 @@ while (true) {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
files.map(async ({ path, data }) => {
|
files.map(async ({ path, data }) => {
|
||||||
const { dir } = parsePath(path);
|
const { dir } = parsePath(path);
|
||||||
|
const dirPath = `${DATA}/${dir}`;
|
||||||
|
|
||||||
|
if (!existsSync(dirPath)) {
|
||||||
|
await mkdir(dirPath, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
await mkdir(`${DATA}/${dir}`, { recursive: true });
|
|
||||||
await writeFile(
|
await writeFile(
|
||||||
`${DATA}/${path}`,
|
`${DATA}/${path}`,
|
||||||
new Uint8Array(writeDVPL(Buffer.from(data))),
|
new Uint8Array(writeDVPL(Buffer.from(data))),
|
||||||
|
|||||||
Reference in new issue
Block a user