"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.downloadLargeFile=downloadLargeFile;const path=require("path"),fse=require("fs-extra"),download=require("download"),promiseMap={};async function downloadLargeFile(e,o){if(console.log("[downloadLargeFile]",e,o),promiseMap[e])return promiseMap[e];fse.ensureDirSync(path.dirname(o));try{const a=(new Date).getTime(),r=download(e);promiseMap[e]=r,fse.writeFileSync(o,await r),console.log(`[downloadLargeFile]download finish ${o}. cost: ${(new Date).getTime()-a}ms`)}catch(o){throw console.log("download file fail: "+e,o),o}finally{delete promiseMap[e]}}