diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-21 03:01:58 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-21 03:01:58 +0800 |
commit | cabce8cb674e937a566e8a821e3959076390f603 (patch) | |
tree | 085b13d8d39c78ae6b5b58157ad73ca5efea544f /packages/sol-compiler/src/utils/fs_wrapper.ts | |
parent | 44cc5e45cc3a3ed7db2691a287500e5d61a2d0c1 (diff) | |
parent | 756787c61fff9c6b463fbbd69b48210dafe62004 (diff) | |
download | dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar.gz dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar.bz2 dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar.lz dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar.xz dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.tar.zst dexon-sol-tools-cabce8cb674e937a566e8a821e3959076390f603.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/connect/sra-api-v2
Diffstat (limited to 'packages/sol-compiler/src/utils/fs_wrapper.ts')
-rw-r--r-- | packages/sol-compiler/src/utils/fs_wrapper.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/sol-compiler/src/utils/fs_wrapper.ts b/packages/sol-compiler/src/utils/fs_wrapper.ts index cc7b06175..8d6800276 100644 --- a/packages/sol-compiler/src/utils/fs_wrapper.ts +++ b/packages/sol-compiler/src/utils/fs_wrapper.ts @@ -10,4 +10,19 @@ export const fsWrapper = { 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), + doesFileExistAsync: async (filePath: string): Promise<boolean> => { + try { + await fsWrapper.accessAsync( + filePath, + // node says we need to use bitwise, but tslint says no: + fs.constants.F_OK | fs.constants.R_OK, // tslint:disable-line:no-bitwise + ); + } catch (err) { + return false; + } + return true; + }, }; |