"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _axios=_interopRequireDefault(require("axios"));
var _fs=_interopRequireDefault(require("fs"));var _default=

(address,filename,downloadPath)=>{
return new Promise((resolve,reject)=>{
if(address&&filename){
(0,_axios.default)({
method:"get",
url:address,
responseType:"stream"}).
then(response=>{
let writeStream=_fs.default.createWriteStream(`${downloadPath}/${filename}`);
response.data.pipe(writeStream);
writeStream.on("finish",data=>{
return resolve(data);
});
}).catch(err=>{
return reject(err.message);
});
}
});
};exports.default=_default;