-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
41 lines (32 loc) · 946 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;(async function() {
const tinybee = require('tinybee')({
folderNameOrCorestore: './location',
inputName: 'test',
...options
});
await tinybee.put('a', 0);
await tinybee.put('b', 'string');
await tinybee.put('c', { d: [0, 1, 2] });
console.log(await tinybee.get('a')); // 0
console.log(await tinybee.get('b')); // 'string'
console.log(await tinybee.get('c')); // { d: [0, 1, 2] }
// del
await tinybee.del('a');
// using subs
const subName = 'subName';
await tinybee.put('a', 0, subName);
console.log(await tinybee.get('a', subName));
await tinybee.del('a', subName);
// get all entries as JSON object
await tinybee.get();
await tinybee.get(undefined, subName);
await tinybee.batch([
['put', 'h', 9],
['del', 'xyz'],
['put', 'abc', { frog: true }]
]);
await tinybee.batch([
['put', 'name', 'benz'],
['put', 'password', 'xxxx']
], subName);
})();