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

Method download

scripts/benchmark.js:275–292  ·  view source on GitHub ↗
(url, dest)

Source from the content-addressed store, hash-verified

273 ).then(() => files.map(filename => this.filePath(filename)));
274 }
275 download(url, dest) {
276 if (DEBUG) console.error(`Downloading ${url}`);
277
278 return new Promise((resolve, reject) => {
279 const file = fs.createWriteStream(dest);
280
281 request(url)
282 .pipe(file)
283 .on("error", err => {
284 fs.unlink(dest);
285 reject(err);
286 });
287
288 file.on("finish", () => file.close(resolve));
289 }).then(() => {
290 if (DEBUG) console.error(`Download Complete ${url}`);
291 });
292 }
293}
294
295function pathExists(file) {

Callers 1

updateCacheMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected