deth
Version:
Ethereum node focused on Developer Experience
32 lines (31 loc) • 986 B
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const glob = __importStar(require("glob"));
const Path_1 = require("./Path");
class RealFileSystem {
fileExists(path) {
return fs.existsSync(path);
}
findFiles(pattern, basePath) {
const paths = glob.sync(pattern, { cwd: basePath, absolute: true });
return paths.map(Path_1.makePath);
}
listDir(path) {
return fs.readdirSync(path).map(Path_1.makePath);
}
readFile(path) {
return fs.readFileSync(path, 'utf8');
}
requireFile(path) {
return require(path);
}
}
exports.RealFileSystem = RealFileSystem;