create-arena-project
Version:
神奇代码岛<->VSCode,从这里开始,创建一个神岛代码项目的脚手架。
33 lines (25 loc) • 624 B
JavaScript
import { promises as fs } from "fs";
function readFile(filePath) {
return fs.readFile(filePath, "utf-8");
}
function writeFile(filePath, data) {
return fs.writeFile(filePath, data, "utf-8");
}
function createDir(dirPath) {
return fs.mkdir(dirPath, { recursive: true });
}
function createFile(filePath) {
return writeFile(filePath, "");
}
function isFileExists(filePath) {
try {
fs.access(filePath);
return true;
} catch (err) {
return false;
}
}
function copyFile(src, dest) {
return fs.copyFile(src, dest);
}
export { readFile, writeFile, createDir, createFile, copyFile, isFileExists };