aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-compiler/src/utils/fs_wrapper.ts
blob: 44c97bd1ec7f951483cc38fec1853f4aeb8d025a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { promisify } from '@0xproject/utils';
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';

export const fsWrapper = {
    readdirAsync: promisify<string[]>(fs.readdir),
    readFileAsync: promisify<string>(fs.readFile),
    writeFileAsync: promisify<undefined>(fs.writeFile),
    mkdirpAsync: promisify<undefined>(mkdirp),
    doesPathExistSync: fs.existsSync,
    rmdirSync: fs.rmdirSync,
    removeFileAsync: promisify<undefined>(fs.unlink),
    statAsync: promisify<fs.Stats>(fs.stat),
    appendFileAsync: promisify<undefined>(fs.appendFile),
    accessAsync: promisify<boolean>(fs.access),
};