File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import * as fs from "fs" ;
2+ import { promisify } from "util" ;
23
34import { FileSystem } from "./fileSystem" ;
45
6+ const readFile = promisify ( fs . readFile ) ;
7+ const writeFile = promisify ( fs . writeFile ) ;
8+
59export const fsFileSystem : FileSystem = {
610 fileExists : async ( filePath : string ) => {
711 try {
@@ -12,14 +16,14 @@ export const fsFileSystem: FileSystem = {
1216 } ,
1317 readFile : async ( filePath : string ) => {
1418 try {
15- return ( await fs . promises . readFile ( filePath ) ) . toString ( ) ;
19+ return ( await readFile ( filePath ) ) . toString ( ) ;
1620 } catch ( error ) {
1721 return error ;
1822 }
1923 } ,
2024 writeFile : async ( filePath : string , contents : string ) => {
2125 try {
22- return fs . promises . writeFile ( filePath , contents ) ;
26+ return writeFile ( filePath , contents ) ;
2327 } catch ( error ) {
2428 return error ;
2529 }
You can’t perform that action at this time.
0 commit comments