1 Commits
0.2.1 ... 0.2.2

Author SHA1 Message Date
d10ee1d686 Auto caching
All checks were successful
Publish Library / Build NPM Project (push) Successful in 9s
Publish Library / Tag Version (push) Successful in 7s
2026-08-22 17:31:50 -04:00
2 changed files with 1 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ztimson/zim-utils", "name": "@ztimson/zim-utils",
"version": "0.2.1", "version": "0.2.2",
"description": "Native, dependency-light ZIM archive reader/searcher and Kiwix catalog downloader for Node.js", "description": "Native, dependency-light ZIM archive reader/searcher and Kiwix catalog downloader for Node.js",
"author": "Zak Timson", "author": "Zak Timson",
"license": "MIT", "license": "MIT",

View File

@@ -160,16 +160,6 @@ export class ZimManager {
/** Opens a fresh `ZimReader` for a local ZIM, resolved by file path or catalog `name`. Caller must `.close()` it. */ /** Opens a fresh `ZimReader` for a local ZIM, resolved by file path or catalog `name`. Caller must `.close()` it. */
async open(fileOrName) { async open(fileOrName) {
await this.#ensureDir();
const file = await this.#resolveFile(fileOrName);
return new ZimReader(file, {clusterTTL: this.#clusterTTL}).open();
}
/**
* Returns a cached, persistently-open `ZimReader` for serving requests — avoids
* re-opening the file per request. Idle-evicted after `readerTTL` ms of no use.
*/
async getCached(fileOrName) {
await this.#ensureDir(); await this.#ensureDir();
const file = await this.#resolveFile(fileOrName); const file = await this.#resolveFile(fileOrName);
let entry = this.#readers.get(file); let entry = this.#readers.get(file);