This repository has been archived on 2026-02-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
synthetic-consumer-data/src/utils/createFolder.ts

19 lines
442 B
TypeScript

import { promises as fs } from 'fs';
export async function createFolderIfNotExists(
folderPath: string
): Promise<void> {
try {
await fs.access(folderPath);
console.log('Folder already exists');
} catch {
try {
await fs.mkdir(folderPath, { recursive: true });
console.log('Folder created successfully');
} catch (error) {
console.error('Error creating folder:', error);
throw error;
}
}
}