This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-04-02 02:24:13 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = require("fs-extra");
/**
* A non-failing version of async FS stat.
*
* @param file
*/
async function statAsync(file) {
try {
return await fs_extra_1.stat(file);
}
catch (_a) {
return null;
}
}
async function fileExistsAsync(file) {
var _a, _b;
return (_b = (_a = (await statAsync(file))) === null || _a === void 0 ? void 0 : _a.isFile()) !== null && _b !== void 0 ? _b : false;
}
exports.fileExistsAsync = fileExistsAsync;
async function directoryExistsAsync(file) {
var _a, _b;
return (_b = (_a = (await statAsync(file))) === null || _a === void 0 ? void 0 : _a.isDirectory()) !== null && _b !== void 0 ? _b : false;
}
exports.directoryExistsAsync = directoryExistsAsync;
function fileExists(file) {
try {
return fs_extra_1.statSync(file).isFile();
}
catch (e) {
return false;
}
}
exports.fileExists = fileExists;
//# sourceMappingURL=modules.js.map