file copyright author Vivek M. Chawla <@VivekMChawla>
 *  summary description version license import { SfdxFalconDebug } from '../sfdx-falcon-debug' ; import { SfdxFalconError } from '../sfdx-falcon-error' ; import { waitASecond } from '../sfdx-falcon-util/async' ; const unzipper = require ( 'unzipper' ) ; const fs = require ( 'fs' ) ; const dbgNs = 'UTILITY:zip:' ; function param { string } zipFile param { string } zipExtractTarget returns { Promise < void > } description public async export async function extract ( zipFile , zipExtractTarget ) { SfdxFalconDebug . obj ( `${ dbgNs }extract:arguments:` , arguments , `arguments: ` ) ; await waitASecond ( 3 ) ; return new Promise ( ( resolve , reject ) => { const readStream = fs . createReadStream ( zipFile ) ; readStream . on ( 'error' , error => { readStream . destroy ( ) ; reject ( new SfdxFalconError ( `Extraction failed. ${ error . message ? error . message : 'Cause of failure is unknown.' }` , `ExtractionError` , `${ dbgNs }extract` , error ) ) ; } ) . pipe ( unzipper . Extract ( { path : zipExtractTarget } ) ) . on ( 'close' , ( ) => { resolve ( ) ; } ) . on ( 'error' , error => { reject ( new SfdxFalconError ( `Extraction failed. ${ error . message ? error . message : 'Cause of failure is unknown.' }` , `ExtractionError` , `${ dbgNs }extract` , error ) ) ; } ) ; } ) ; }