import fs from 'fs' ; export class FileSystemReader { static readFile ( path ) { return new Promise ( ( resolve , reject ) => { fs . readFile ( path , ( error , data ) => { if ( error ) reject ( error ) ; else resolve ( data ) ; } ) ; } ) ; } static readDir ( path ) { return new Promise ( ( resolve , reject ) => { fs . readdir ( path , ( error , files ) => { if ( error ) reject ( error ) ; else resolve ( files ) ; } ) ; } ) ; } static writeFile ( path , content ) { return new Promise ( ( resolve , reject ) => { fs . writeFile ( path , content , { } , ( error ) => { if ( error ) reject ( error ) ; else resolve ( ) ; } ) ; } ) ; } }