"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.extract=extract;exports.default=void 0;var _zipBin=_interopRequireDefault(require("7zip-bin"));
var _node7z=require("node-7z");
var _utils=require("@corenode/utils");

function extract(file,extractPath){
return new Promise((resolve,reject)=>{
const unpackStream=(0,_node7z.extractFull)(file,extractPath,{
$bin:_zipBin.default.path7za,
$progress:true,
recursive:true});


unpackStream.on("progress",progress=>{var _progress$filename;
let printStr=`Extracting ${(_progress$filename=progress.filename)!==null&&_progress$filename!==void 0?_progress$filename:"file ..."}`;
_utils.verbosity.dump(printStr);
});

unpackStream.on("end",()=>{
return resolve("end");
});

unpackStream.on("error",err=>{
_utils.verbosity.options({dumpFile:"only"}).error(err);
return reject(err);
});
});
}var _default=

_node7z.extractFull;exports.default=_default;