update moveFile API

This commit is contained in:
Abhinav 2023-04-25 16:15:44 +05:30
parent e39cb09245
commit 8e16d18014

View file

@ -255,7 +255,7 @@ export async function moveFile(
// check if destination folder exists // check if destination folder exists
const destinationFolder = path.dirname(destinationPath); const destinationFolder = path.dirname(destinationPath);
if (!existsSync(destinationFolder)) { if (!existsSync(destinationFolder)) {
throw new Error('Destination folder does not exist'); await fs.mkdir(destinationFolder, { recursive: true });
} }
await fs.rename(sourcePath, destinationPath); await fs.rename(sourcePath, destinationPath);
} }