@openzim/libzim 3.3.0 → 3.5.0
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/Changelog +8 -0
- package/binding.gyp +22 -1
- package/bundle-libzim.js +13 -5
- package/dist/index.d.ts +8 -0
- package/package.json +5 -2
- package/src/archive.h +95 -0
- package/src/index.d.ts +8 -0
package/Changelog
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
3.5.0
|
|
2
|
+
* NEW: Build now supports ARM64 (`aarch64`) and ARM (32‑bit)
|
|
3
|
+
* UPDATE: CI matrix extended with ARM64 Ubuntu runners
|
|
4
|
+
* UPDATE: drop Node.JS 18, add Node.JS 24
|
|
5
|
+
|
|
6
|
+
3.4.0
|
|
7
|
+
* NEW: Add new libzim 9.3.0 APIs around cache management
|
|
8
|
+
|
|
1
9
|
3.3.0
|
|
2
10
|
* NEW: Use libzim 9.3.0
|
|
3
11
|
* UPDATE: Upgrade many dependencies versions
|
package/binding.gyp
CHANGED
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
"link_settings": {
|
|
12
12
|
"ldflags": [
|
|
13
13
|
"<!(pkg-config --libs-only-other --libs-only-L libzim)",
|
|
14
|
+
"-Wl,-rpath,<!(pkg-config --variable=libdir libzim)>"
|
|
14
15
|
],
|
|
15
16
|
"libraries": [
|
|
16
17
|
"<!(pkg-config --libs-only-l libzim)",
|
|
17
18
|
],
|
|
18
19
|
},
|
|
19
20
|
}],
|
|
20
|
-
["libzim_local!='true' and OS=='linux'", {
|
|
21
|
+
["libzim_local!='true' and OS=='linux' and target_arch=='x64'", {
|
|
21
22
|
"include_dirs": [
|
|
22
23
|
"<(libzim_include)",
|
|
23
24
|
],
|
|
@@ -27,6 +28,26 @@
|
|
|
27
28
|
"<(libzim_dir)/lib/x86_64-linux-gnu/libzim.so.9",
|
|
28
29
|
],
|
|
29
30
|
}],
|
|
31
|
+
["libzim_local!='true' and OS=='linux' and target_arch=='arm64'", {
|
|
32
|
+
"include_dirs": [
|
|
33
|
+
"<(libzim_include)",
|
|
34
|
+
],
|
|
35
|
+
"libraries": [
|
|
36
|
+
"-Wl,-rpath,'$$ORIGIN'",
|
|
37
|
+
"-L<(libzim_dir)/lib/aarch64-linux-gnu",
|
|
38
|
+
"<(libzim_dir)/lib/aarch64-linux-gnu/libzim.so.9",
|
|
39
|
+
],
|
|
40
|
+
}],
|
|
41
|
+
["libzim_local!='true' and OS=='linux' and target_arch=='arm'", {
|
|
42
|
+
"include_dirs": [
|
|
43
|
+
"<(libzim_include)",
|
|
44
|
+
],
|
|
45
|
+
"libraries": [
|
|
46
|
+
"-Wl,-rpath,'$$ORIGIN'",
|
|
47
|
+
"-L<(libzim_dir)/lib/arm-linux-gnueabihf",
|
|
48
|
+
"<(libzim_dir)/lib/arm-linux-gnueabihf/libzim.so.9",
|
|
49
|
+
],
|
|
50
|
+
}],
|
|
30
51
|
["libzim_local!='true' and OS=='mac'", {
|
|
31
52
|
"include_dirs": ["<(libzim_include)"],
|
|
32
53
|
"cflags+": ["-fvisibility=hidden"],
|
package/bundle-libzim.js
CHANGED
|
@@ -16,11 +16,19 @@ if (!isMacOS && !isLinux) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (isLinux) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const rawArch = os.arch();
|
|
20
|
+
let libDir;
|
|
21
|
+
if (rawArch === "arm64") {
|
|
22
|
+
libDir = "aarch64-linux-gnu";
|
|
23
|
+
} else if (rawArch === "arm") {
|
|
24
|
+
libDir = "arm-linux-gnueabihf";
|
|
25
|
+
} else {
|
|
26
|
+
libDir = "x86_64-linux-gnu";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
console.info(`Copying libzim.so.9 from ${libDir} to build folder`);
|
|
30
|
+
exec(`cp download/lib/${libDir}/libzim.so.9 build/Release/libzim.so.9`);
|
|
31
|
+
exec("ln -sf build/Release/libzim.so.9 build/Release/libzim.so"); // convenience only, not required
|
|
24
32
|
}
|
|
25
33
|
if (isMacOS) {
|
|
26
34
|
console.info("Copying libzim.9.dylib to build folder");
|
package/dist/index.d.ts
CHANGED
|
@@ -182,6 +182,14 @@ export class Archive {
|
|
|
182
182
|
checkIntegrity(checkType: symbol): boolean; // one of IntegrityCheck
|
|
183
183
|
get isMultiPart(): boolean;
|
|
184
184
|
get hasNewNamespaceScheme(): boolean;
|
|
185
|
+
getClusterCacheMaxSize(): number;
|
|
186
|
+
getClusterCacheCurrentSize(): number;
|
|
187
|
+
setClusterCacheMaxSize(nbClusters: number): void;
|
|
188
|
+
getDirentCacheMaxSize(): number;
|
|
189
|
+
getDirentCacheCurrentSize(): number;
|
|
190
|
+
setDirentCacheMaxSize(nbDirents: number): void;
|
|
191
|
+
getDirentLookupCacheMaxSize(): number;
|
|
192
|
+
setDirentLookupCacheMaxSize(nbRanges: number): void;
|
|
185
193
|
|
|
186
194
|
static validate(zimPath: string, checksToRun: symbol[]): boolean; // list of IntegrityCheck
|
|
187
195
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@openzim/libzim",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"types": "dist/index.d.js",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.5.0",
|
|
6
6
|
"description": "Libzim bindings for NodeJS",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"bugs": {
|
|
39
39
|
"url": "https://github.com/openzim/node-libzim/issues"
|
|
40
40
|
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20 <25"
|
|
43
|
+
},
|
|
41
44
|
"homepage": "https://github.com/openzim/node-libzim#readme",
|
|
42
45
|
"gypfile": true,
|
|
43
46
|
"dependencies": {
|
|
@@ -70,4 +73,4 @@
|
|
|
70
73
|
"jest": {
|
|
71
74
|
"preset": "ts-jest/presets/js-with-ts"
|
|
72
75
|
}
|
|
73
|
-
}
|
|
76
|
+
}
|
package/src/archive.h
CHANGED
|
@@ -411,6 +411,85 @@ class Archive : public Napi::ObjectWrap<Archive> {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
+
Napi::Value getClusterCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
415
|
+
try {
|
|
416
|
+
return Napi::Value::From(info.Env(), archive_->getClusterCacheMaxSize());
|
|
417
|
+
} catch (const std::exception &err) {
|
|
418
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
Napi::Value getClusterCacheCurrentSize(const Napi::CallbackInfo &info) {
|
|
423
|
+
try {
|
|
424
|
+
return Napi::Value::From(info.Env(),
|
|
425
|
+
archive_->getClusterCacheCurrentSize());
|
|
426
|
+
} catch (const std::exception &err) {
|
|
427
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
void setClusterCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
432
|
+
try {
|
|
433
|
+
if (!info[0].IsNumber()) {
|
|
434
|
+
throw Napi::Error::New(info.Env(), "Expected a number");
|
|
435
|
+
}
|
|
436
|
+
auto nbClusters = info[0].As<Napi::Number>().Uint32Value();
|
|
437
|
+
archive_->setClusterCacheMaxSize(nbClusters);
|
|
438
|
+
} catch (const std::exception &err) {
|
|
439
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
Napi::Value getDirentCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
444
|
+
try {
|
|
445
|
+
return Napi::Value::From(info.Env(), archive_->getDirentCacheMaxSize());
|
|
446
|
+
} catch (const std::exception &err) {
|
|
447
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
Napi::Value getDirentCacheCurrentSize(const Napi::CallbackInfo &info) {
|
|
452
|
+
try {
|
|
453
|
+
return Napi::Value::From(info.Env(),
|
|
454
|
+
archive_->getDirentCacheCurrentSize());
|
|
455
|
+
} catch (const std::exception &err) {
|
|
456
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
void setDirentCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
461
|
+
try {
|
|
462
|
+
if (!info[0].IsNumber()) {
|
|
463
|
+
throw Napi::Error::New(info.Env(), "Expected a number");
|
|
464
|
+
}
|
|
465
|
+
auto nbDirents = info[0].As<Napi::Number>().Uint32Value();
|
|
466
|
+
archive_->setDirentCacheMaxSize(nbDirents);
|
|
467
|
+
} catch (const std::exception &err) {
|
|
468
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
Napi::Value getDirentLookupCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
473
|
+
try {
|
|
474
|
+
return Napi::Value::From(info.Env(),
|
|
475
|
+
archive_->getDirentLookupCacheMaxSize());
|
|
476
|
+
} catch (const std::exception &err) {
|
|
477
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
void setDirentLookupCacheMaxSize(const Napi::CallbackInfo &info) {
|
|
482
|
+
try {
|
|
483
|
+
if (!info[0].IsNumber()) {
|
|
484
|
+
throw Napi::Error::New(info.Env(), "Expected a number");
|
|
485
|
+
}
|
|
486
|
+
auto nbRanges = info[0].As<Napi::Number>().Uint32Value();
|
|
487
|
+
archive_->setDirentLookupCacheMaxSize(nbRanges);
|
|
488
|
+
} catch (const std::exception &err) {
|
|
489
|
+
throw Napi::Error::New(info.Env(), err.what());
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
414
493
|
static Napi::Value validate(const Napi::CallbackInfo &info) {
|
|
415
494
|
Napi::Env env = info.Env();
|
|
416
495
|
Napi::HandleScope scope(env);
|
|
@@ -485,6 +564,22 @@ class Archive : public Napi::ObjectWrap<Archive> {
|
|
|
485
564
|
InstanceAccessor<&Archive::getChecksum>("checksum"),
|
|
486
565
|
InstanceMethod<&Archive::check>("check"),
|
|
487
566
|
InstanceMethod<&Archive::checkIntegrity>("checkIntegrity"),
|
|
567
|
+
InstanceMethod<&Archive::getClusterCacheMaxSize>(
|
|
568
|
+
"getClusterCacheMaxSize"),
|
|
569
|
+
InstanceMethod<&Archive::getClusterCacheCurrentSize>(
|
|
570
|
+
"getClusterCacheCurrentSize"),
|
|
571
|
+
InstanceMethod<&Archive::setClusterCacheMaxSize>(
|
|
572
|
+
"setClusterCacheMaxSize"),
|
|
573
|
+
InstanceMethod<&Archive::getDirentCacheMaxSize>(
|
|
574
|
+
"getDirentCacheMaxSize"),
|
|
575
|
+
InstanceMethod<&Archive::getDirentCacheCurrentSize>(
|
|
576
|
+
"getDirentCacheCurrentSize"),
|
|
577
|
+
InstanceMethod<&Archive::setDirentCacheMaxSize>(
|
|
578
|
+
"setDirentCacheMaxSize"),
|
|
579
|
+
InstanceMethod<&Archive::getDirentLookupCacheMaxSize>(
|
|
580
|
+
"getDirentLookupCacheMaxSize"),
|
|
581
|
+
InstanceMethod<&Archive::setDirentLookupCacheMaxSize>(
|
|
582
|
+
"setDirentLookupCacheMaxSize"),
|
|
488
583
|
InstanceAccessor<&Archive::isMultiPart>("isMultiPart"),
|
|
489
584
|
InstanceAccessor<&Archive::hasNewNamespaceScheme>(
|
|
490
585
|
"hasNewNamespaceScheme"),
|
package/src/index.d.ts
CHANGED
|
@@ -182,6 +182,14 @@ export class Archive {
|
|
|
182
182
|
checkIntegrity(checkType: symbol): boolean; // one of IntegrityCheck
|
|
183
183
|
get isMultiPart(): boolean;
|
|
184
184
|
get hasNewNamespaceScheme(): boolean;
|
|
185
|
+
getClusterCacheMaxSize(): number;
|
|
186
|
+
getClusterCacheCurrentSize(): number;
|
|
187
|
+
setClusterCacheMaxSize(nbClusters: number): void;
|
|
188
|
+
getDirentCacheMaxSize(): number;
|
|
189
|
+
getDirentCacheCurrentSize(): number;
|
|
190
|
+
setDirentCacheMaxSize(nbDirents: number): void;
|
|
191
|
+
getDirentLookupCacheMaxSize(): number;
|
|
192
|
+
setDirentLookupCacheMaxSize(nbRanges: number): void;
|
|
185
193
|
|
|
186
194
|
static validate(zimPath: string, checksToRun: symbol[]): boolean; // list of IntegrityCheck
|
|
187
195
|
}
|