UNPKG

deth

Version:

Ethereum node focused on Developer Experience

22 lines (21 loc) 552 B
import * as fs from 'fs'; import * as glob from 'glob'; import { makePath } from './Path'; export class RealFileSystem { fileExists(path) { return fs.existsSync(path); } findFiles(pattern, basePath) { const paths = glob.sync(pattern, { cwd: basePath, absolute: true }); return paths.map(makePath); } listDir(path) { return fs.readdirSync(path).map(makePath); } readFile(path) { return fs.readFileSync(path, 'utf8'); } requireFile(path) { return require(path); } }