refunjs
Version:
Modern React-based framework for building scalable web applications with enhanced developer experience
14 lines (12 loc) • 454 B
JavaScript
import fs from "fs";
import path from "path";
export function copyDir(src, dest) {
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
const entries = fs.readdirSync(src, { withFileTypes: true });
for (let entry of entries) {
const srcPath = path.join(src, entry.name);
const destPath = path.join(dest, entry.name);
if (entry.isDirectory()) copyDir(srcPath, destPath);
else fs.copyFileSync(srcPath, destPath);
}
}