File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ import * as os from "os";
33import * as path from "path" ;
44import isThere from "is-there" ;
55import * as mkdirp from 'mkdirp' ;
6+ import * as util from "util" ;
7+
8+ const writeFile = util . promisify ( fs . writeFile ) ;
69
710
811interface DtsContentOptions {
@@ -65,20 +68,13 @@ export class DtsContent {
6568 return path . join ( this . rootDir , this . searchDir , this . rInputPath ) ;
6669 }
6770
68- public writeFile ( ) : Promise < DtsContent > {
71+ public async writeFile ( ) : Promise < void > {
6972 var outPathDir = path . dirname ( this . outputFilePath ) ;
7073 if ( ! isThere ( outPathDir ) ) {
7174 mkdirp . sync ( outPathDir ) ;
7275 }
73- return new Promise ( ( resolve , reject ) => {
74- fs . writeFile ( this . outputFilePath , this . formatted , 'utf8' , ( err ) => {
75- if ( err ) {
76- reject ( err ) ;
77- } else {
78- resolve ( this ) ;
79- }
80- } ) ;
81- } ) ;
76+
77+ await writeFile ( this . outputFilePath , this . formatted , 'utf8' ) ;
8278 }
8379}
8480
You can’t perform that action at this time.
0 commit comments