@@ -13,22 +13,26 @@ export class FileSystem {
1313
1414 public extractZip ( pathToZip : string , outputDir : string ) : Promise < void > {
1515 return new Promise ( ( resolve , reject ) => {
16- yauzl . open ( pathToZip , { autoClose : true , lazyEntries : true } , ( e , zipFile ) => {
17- if ( e ) return reject ( e ) ;
16+ yauzl . open ( pathToZip , { autoClose : true , lazyEntries : true } , ( openError , zipFile ) => {
17+ if ( openError ) {
18+ return reject ( openError ) ;
19+ }
1820
1921 zipFile . on ( 'entry' , entry => {
2022 const fn = < string > entry . fileName ;
2123 if ( / \/ $ / . test ( fn ) ) {
2224 return zipFile . readEntry ( ) ;
2325 }
2426
25- zipFile . openReadStream ( entry , ( err , stream ) => {
26- if ( err ) return reject ( err ) ;
27+ zipFile . openReadStream ( entry , ( openStreamError , stream ) => {
28+ if ( openStreamError ) {
29+ return reject ( openStreamError ) ;
30+ } ;
2731
2832 const filePath = `${ outputDir } /${ fn } ` ;
2933
3034 return createParentDirsIfNeeded ( filePath )
31- . catch ( e => reject ( e ) )
35+ . catch ( createParentDirError => reject ( createParentDirError ) )
3236 . then ( ( ) => {
3337 const outfile = createOutfile ( filePath ) ;
3438 stream . once ( 'end' , ( ) => {
@@ -44,7 +48,7 @@ export class FileSystem {
4448
4549 zipFile . readEntry ( ) ;
4650 } ) ;
47- } )
51+ } ) ;
4852 }
4953
5054 public readDirectory ( path : string ) : string [ ] {
@@ -70,4 +74,4 @@ function createParentDirsIfNeeded(filePath: string) {
7074
7175function createOutfile ( path : string ) : fs . WriteStream {
7276 return fs . createWriteStream ( path ) ;
73- }
77+ }
0 commit comments