Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
example/ | 12-May-2024 | - | 97 | 79 | ||
.eslintrc | D | 12-May-2024 | 1 KiB | 55 | 55 | |
.gitignore | D | 12-May-2024 | 0 | |||
CHANGELOG.md | D | 12-May-2024 | 77 | 4 | 2 | |
CMakeLists.txt | D | 12-May-2024 | 3.2 KiB | 93 | 80 | |
README.md | D | 12-May-2024 | 1.6 KiB | 67 | 46 | |
binary.js | D | 12-May-2024 | 1.6 KiB | 36 | 6 | |
ejdb2_node.c | D | 12-May-2024 | 54.2 KiB | 2,092 | 1,795 | |
hints.txt | D | 12-May-2024 | 131 | 3 | 2 | |
index.d.ts | D | 12-May-2024 | 11.4 KiB | 463 | 94 | |
index.js | D | 12-May-2024 | 18.1 KiB | 722 | 358 | |
install.js | D | 12-May-2024 | 3.4 KiB | 90 | 52 | |
js_native_api.h | D | 12-May-2024 | 27.9 KiB | 558 | 445 | |
js_native_api_types.h | D | 12-May-2024 | 3.8 KiB | 147 | 115 | |
node_api.h | D | 12-May-2024 | 11.3 KiB | 269 | 213 | |
node_api_types.h | D | 12-May-2024 | 1.6 KiB | 51 | 42 | |
package.json | D | 12-May-2024 | 1.2 KiB | 71 | 70 | |
test.js | D | 12-May-2024 | 6.6 KiB | 249 | 161 | |
tsconfig.json | D | 12-May-2024 | 561 | 26 | 26 | |
tslint.json | D | 12-May-2024 | 1 KiB | 53 | 53 | |
utils.js | D | 12-May-2024 | 3.8 KiB | 128 | 82 | |
version.txt | D | 12-May-2024 | 1 | |||
yarn.lock | D | 12-May-2024 | 133.6 KiB | 3,213 | 2,743 |
README.md
1# EJDB2 Node.js native binding 2 3Embeddable JSON Database engine http://ejdb.org Node.js binding. 4 5See https://github.com/Softmotions/ejdb/blob/master/README.md 6 7For API usage examples take a look into [/example](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_node/example) and [test.js](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_node/test.js) 8 9## Note on versioning 10 11Since `2020-12-22` a new version scheme is used and the major version 12of node package has been incremented. Now package version is the concatenation 13of ejdb2 core engine version and version serial number of this binding. 14For example: given ejdb2 version `2.0.52` and binding serial `2` 15the actual package version will be `2.0.522`. 16 17## Sample code 18 19```ts 20import { EJDB2 } from "ejdb2_node"; 21 22async function run() { 23 const db = await EJDB2.open("example.db", { truncate: true }); 24 25 var id = await db.put("parrots", { name: "Bianca", age: 4 }); 26 console.log(`Bianca record: ${id}`); 27 28 id = await db.put("parrots", { name: "Darko", age: 8 }); 29 console.log(`Darko record: ${id}`); 30 31 const q = db.createQuery("/[age > :age]", "parrots"); 32 33 for await (const doc of q.setNumber("age", 3).stream()) { 34 console.log(`Found ${doc}`); 35 } 36 37 await db.close(); 38} 39 40run(); 41``` 42 43## Supported platforms 44 45- Linux x64 46- OSX 47 48## Prerequisites 49 50- node >= v10.0.0 51- yarn 52- CMake >= v3.10 53- Make 54- gcc or clang compiler 55 56## How build it manually 57 58```sh 59git clone https://github.com/Softmotions/ejdb.git 60cd ./ejdb 61mkdir ./build && cd build 62cmake .. -DBUILD_NODEJS_BINDING=ON -DCMAKE_BUILD_TYPE=Release 63make 64cd src/bindings/ejdb2_node/ejdb2_node 65yarn pack 66``` 67