b4n1-boost 0.3.9 → 0.3.10
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/README.md +33 -4
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# b4n1-boost for Node.js
|
|
2
2
|
|
|
3
|
-
**The Native Accelerator.** One
|
|
3
|
+
**The Native Accelerator.** One core engine with SDKs for Python, Node.js, .NET and Java — JSON 10x faster, compression 28x faster. BSL-1.1 (native binary under EULA.txt).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,19 +8,48 @@
|
|
|
8
8
|
npm install b4n1-boost
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
| Platform | Status |
|
|
12
|
+
|---|---|
|
|
13
|
+
| linux-x64, linux-arm64 | native included |
|
|
14
|
+
| macos-x64, macos-arm64 | native included |
|
|
15
|
+
| windows-x64 | native included |
|
|
16
|
+
| others | pure-JS fallback (slower, same API) |
|
|
14
17
|
|
|
15
18
|
## Use
|
|
16
19
|
|
|
17
20
|
```js
|
|
18
21
|
const B4N1Boost = require('b4n1-boost');
|
|
22
|
+
|
|
23
|
+
// Compression / validation / minify (native when available)
|
|
19
24
|
const gz = B4N1Boost.compressGzip(Buffer.from('hello'.repeat(1000)));
|
|
20
25
|
const ok = B4N1Boost.isJsonValid('{"a":1}');
|
|
21
26
|
const min = B4N1Boost.minifyHtml('<p> hi </p>');
|
|
22
27
|
```
|
|
23
28
|
|
|
29
|
+
## Background tasks (no Redis, no BullMQ)
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const { background, pendingTasks } = require('b4n1-boost/background');
|
|
33
|
+
|
|
34
|
+
// Returns immediately (~ms); heavy work runs in a worker thread.
|
|
35
|
+
// Every submission is journaled to disk: a restart never loses a record.
|
|
36
|
+
const sendReport = background(async (userId) => {
|
|
37
|
+
/* ...build PDF, send email... */
|
|
38
|
+
return `report-${userId}`;
|
|
39
|
+
}, { journal: './b4n1-tasks.jsonl' });
|
|
40
|
+
|
|
41
|
+
const handle = sendReport(42);
|
|
42
|
+
const result = await handle; // wait when you need it
|
|
43
|
+
console.log(pendingTasks('./b4n1-tasks.jsonl')); // crash recovery: re-run these
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Works with Express out of the box:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
const express = require('express');
|
|
50
|
+
require('b4n1-boost/express');
|
|
51
|
+
```
|
|
52
|
+
|
|
24
53
|
## Test
|
|
25
54
|
|
|
26
55
|
```bash
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "b4n1-boost",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"description": "Native accelerator for Node.js & Express: SIMD compression, fast JSON, background tasks without Redis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "node test.js"
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
"zstd",
|
|
12
12
|
"minify",
|
|
13
13
|
"json-validation",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"background-tasks",
|
|
15
|
+
"performance",
|
|
16
|
+
"express",
|
|
17
|
+
"middleware",
|
|
18
|
+
"native"
|
|
16
19
|
],
|
|
17
20
|
"author": "B4N1 Team <dev@b4n1.com>",
|
|
18
21
|
"license": "BSL-1.1",
|