@interopio/desktop-cli
Version:
CLI tool for setting up, building and packaging io.Connect Desktop projects
40 lines • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileUtils = void 0;
const fs_extra_1 = __importDefault(require("fs-extra"));
class FileUtils {
static async exists(filePath) {
try {
await fs_extra_1.default.access(filePath);
return true;
}
catch {
return false;
}
}
static async ensureDir(dirPath) {
await fs_extra_1.default.ensureDir(dirPath);
}
static async copyFile(src, dest) {
await fs_extra_1.default.copy(src, dest);
}
static async removeFile(filePath) {
if (await this.exists(filePath)) {
await fs_extra_1.default.remove(filePath);
}
}
static readJson(filePath) {
return fs_extra_1.default.readJsonSync(filePath);
}
static async writeJson(filePath, data) {
await fs_extra_1.default.writeJson(filePath, data, { spaces: 2 });
}
static async writeFile(filePath, content) {
await fs_extra_1.default.writeFile(filePath, content, 'utf8');
}
}
exports.FileUtils = FileUtils;
//# sourceMappingURL=file.js.map