MCPcopy Create free account
hub / github.com/adaptlearning/adapt_framework / restoreCache

Function restoreCache

grunt/tasks/javascript.js:25–43  ·  view source on GitHub ↗
(cachePath, basePath)

Source from the content-addressed store, hash-verified

23 const cacheManager = new CacheManager(grunt, grunt.config('cacheAge'));
24
25 const restoreCache = async (cachePath, basePath) => {
26 if (isDisableCache || cache || !fs.existsSync(cachePath)) return;
27 await new Promise((resolve, reject) => {
28 const buffer = fs.readFileSync(cachePath);
29 unzip(buffer, (err, buffer) => {
30 if (err) {
31 console.error('An error occurred restoring rollup cache:', err);
32 process.exitCode = 1;
33 reject(err);
34 return;
35 }
36 let str = buffer.toString();
37 // Restore cache to current basePath
38 str = str.replace(/%%basePath%%/g, basePath);
39 cache = JSON.parse(str);
40 resolve();
41 });
42 });
43 };
44
45 const checkCache = function(invalidate) {
46 if (!cache) return;

Callers 1

javascript.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected