Use an aging system for caches
This commit is contained in:
parent
d312466556
commit
0930af652f
11 changed files with 61 additions and 37 deletions
|
@ -3,6 +3,7 @@
|
|||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const zlib = require("zlib");
|
||||
const { encode } = require("@msgpack/msgpack");
|
||||
|
||||
const { FontIo } = require("ot-builder");
|
||||
const Toml = require("@iarna/toml");
|
||||
|
@ -103,12 +104,5 @@ async function saveCharMap(argv, glyphStore) {
|
|||
...createGrDisplaySheet(glyphStore, gn)
|
||||
]);
|
||||
}
|
||||
await fs.writeFile(argv.oCharMap, zip(charMap));
|
||||
}
|
||||
|
||||
function unzip(buf) {
|
||||
return JSON.parse(zlib.gunzipSync(buf));
|
||||
}
|
||||
function zip(obj) {
|
||||
return zlib.gzipSync(Buffer.from(JSON.stringify(obj), "utf-8"));
|
||||
await fs.writeFile(argv.oCharMap, zlib.gzipSync(encode(charMap)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue