MCPcopy Create free account
hub / github.com/babel/minify / updateCache

Method updateCache

scripts/benchmark.js:261–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259 return path.join(this.cacheDir, filename);
260 }
261 updateCache() {
262 if (DEBUG) console.error("Updating Cache...");
263 const files = Object.keys(this.assets);
264
265 if (!pathExists(this.cacheDir)) fs.mkdirSync(this.cacheDir);
266
267 return Promise.all(
268 files
269 .filter(filename => !pathExists(this.filePath(filename)))
270 .map(filename =>
271 this.download(this.assets[filename], this.filePath(filename))
272 )
273 ).then(() => files.map(filename => this.filePath(filename)));
274 }
275 download(url, dest) {
276 if (DEBUG) console.error(`Downloading ${url}`);
277

Callers 1

runFunction · 0.80

Calls 5

filePathMethod · 0.95
downloadMethod · 0.95
pathExistsFunction · 0.85
keysMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected