@openzim/libzim
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| LIBZIM_VERSION=9.5.1 | ||
| LIBZIM_VERSION=9.7.0 |
+1
-0
@@ -121,2 +121,3 @@ export declare function getClusterCacheMaxSize(): number; | ||
| ): void; | ||
| addAlias(path: string, title: string, targetPath: string, hints?: Hint): void; | ||
| setMainPath(mainPath: string): void; | ||
@@ -123,0 +124,0 @@ setUuid(uuid: string): void; |
+2
-2
| { | ||
| "name": "@openzim/libzim", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.js", | ||
| "version": "4.1.0", | ||
| "types": "dist/index.d.ts", | ||
| "version": "4.2.0", | ||
| "description": "Libzim bindings for NodeJS", | ||
@@ -7,0 +7,0 @@ "type": "module", |
+3
-3
@@ -64,3 +64,3 @@ node-libzim | ||
| // read.js | ||
| import { Archive, SuggestionSearcher, Searcher } from "@openzim/libzim"; | ||
| import { Archive, Query, SuggestionSearcher, Searcher } from "@openzim/libzim"; | ||
@@ -93,8 +93,8 @@ (async () => { | ||
| const entry = await archive.getEntryByPath("A/laborum"); | ||
| const entry = archive.getEntryByPath("A/laborum"); | ||
| const item = entry.item; | ||
| const blob = item.data; | ||
| console.info(`Entry by url (laborum):`, blob.data); | ||
| delete archive; | ||
| })(); | ||
| ``` | ||
@@ -101,0 +101,0 @@ ## Local Development |
+24
-0
@@ -345,2 +345,25 @@ #pragma once | ||
| void addAlias(const Napi::CallbackInfo &info) { | ||
| try { | ||
| auto env = info.Env(); | ||
| if (info.Length() < 3) { | ||
| throw Napi::Error::New(env, | ||
| "addAlias requires arguments: path, title, " | ||
| "targetPath, [hints]"); | ||
| } | ||
| auto path = info[0].As<Napi::String>().Utf8Value(); | ||
| auto title = info[1].As<Napi::String>().Utf8Value(); | ||
| auto targetPath = info[2].As<Napi::String>().Utf8Value(); | ||
| if (info[3].IsObject()) { | ||
| auto hints = Object2Hints(info[3].ToObject()); | ||
| creator_->addAlias(path, title, targetPath, hints); | ||
| } else { | ||
| creator_->addAlias(path, title, targetPath); | ||
| } | ||
| } catch (const std::exception &err) { | ||
| throw Napi::Error::New(info.Env(), err.what()); | ||
| } | ||
| } | ||
| void setMainPath(const Napi::CallbackInfo &info) { | ||
@@ -391,2 +414,3 @@ try { | ||
| InstanceMethod<&Creator::addRedirection>("addRedirection"), | ||
| InstanceMethod<&Creator::addAlias>("addAlias"), | ||
| InstanceMethod<&Creator::setMainPath>("setMainPath"), | ||
@@ -393,0 +417,0 @@ InstanceMethod<&Creator::setUuid>("setUuid"), |
+1
-0
@@ -121,2 +121,3 @@ export declare function getClusterCacheMaxSize(): number; | ||
| ): void; | ||
| addAlias(path: string, title: string, targetPath: string, hints?: Hint): void; | ||
| setMainPath(mainPath: string): void; | ||
@@ -123,0 +124,0 @@ setUuid(uuid: string): void; |
Sorry, the diff of this file is not supported yet
189972
0.6%736
0.27%