@divriots/jampack 0.21.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.js +5 -1
- package/package.json +1 -1
package/dist/cache.js
CHANGED
|
@@ -4,8 +4,11 @@ import * as fs from 'fs/promises';
|
|
|
4
4
|
import $state from './state.js';
|
|
5
5
|
import { CACHE_VERSIONS } from './packagejson.js';
|
|
6
6
|
const listOfCategories = ['img', 'img-ext'];
|
|
7
|
-
|
|
7
|
+
function getCacheFolder() {
|
|
8
|
+
return $state.args.cache_folder || '.jampack/cache';
|
|
9
|
+
}
|
|
8
10
|
async function cleanCache(full) {
|
|
11
|
+
const CACHE_FOLDER = getCacheFolder();
|
|
9
12
|
if (full) {
|
|
10
13
|
try {
|
|
11
14
|
await fs.rm(CACHE_FOLDER, { recursive: true });
|
|
@@ -60,6 +63,7 @@ function getVersionOfCategory(category) {
|
|
|
60
63
|
return CACHE_VERSIONS[category];
|
|
61
64
|
}
|
|
62
65
|
function getLocation(hash, category) {
|
|
66
|
+
const CACHE_FOLDER = getCacheFolder();
|
|
63
67
|
return path.join(CACHE_FOLDER, category, getVersionOfCategory(category), hash);
|
|
64
68
|
}
|
|
65
69
|
async function getFromCache(category, hash) {
|