UNPKG

@gitborlando/utils

Version:

JavaScript/TypeScript 实用工具集合

17 lines (16 loc) 357 B
// src/node/index.ts import { existsSync, mkdirSync } from "fs"; import path from "path"; import { fileURLToPath } from "url"; function getDirname() { return path.dirname(fileURLToPath(import.meta.url)); } function ensureDir(dirPath) { if (!existsSync(dirPath)) { mkdirSync(dirPath, { recursive: true }); } } export { ensureDir, getDirname };