Added delete
All checks were successful
Publish Library / Build NPM Project (push) Successful in 9s
Publish Library / Tag Version (push) Successful in 8s

This commit is contained in:
2026-08-22 13:01:19 -04:00
parent 86730f1de8
commit 4278ea9df9
2 changed files with 7 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ztimson/zim-utils", "name": "@ztimson/zim-utils",
"version": "0.1.4", "version": "0.1.5",
"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

@@ -86,6 +86,12 @@ export class ZimManager {
return zimCatalog(search, opts); return zimCatalog(search, opts);
} }
async delete(fileOrName) {
const file = await this.#resolveFile(fileOrName);
await fs.promises.unlink(file);
return {file, status: 'deleted'};
}
/** Checks whether a local ZIM has a newer version in the catalog, without downloading. */ /** Checks whether a local ZIM has a newer version in the catalog, without downloading. */
async isOutdated(file) { async isOutdated(file) {
const meta = await this.#readMeta(file); const meta = await this.#readMeta(file);