import * as _glob from 'glob' ; import * as bluebird from 'bluebird' ; import * as fs from 'fs' ; export const glob = bluebird . promisify < string [ ] , string > ( _glob ) ; export const readFile = ( path ) => bluebird . fromNode ( cb => fs . readFile ( path , cb ) ) ; export const readFileAsString = async ( path ) => String ( await readFile ( path ) ) ; export const readAsJSON = async ( path ) => JSON . parse ( await readFileAsString ( path ) ) ; export const writeFile = ( path , data ) => bluebird . fromNode ( cb => fs . writeFile ( path , data , cb ) ) ; export const writeAsJSON = ( path , data ) => writeFile ( path , JSON . stringify ( data , undefined , 2 ) ) ; export const fileExists = ( path ) => fs . existsSync ( path ) ;