presidium 3.5.0 → 3.6.1
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 +57 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -353,6 +353,63 @@ const data = await googleChromeDevTools.Page.navigate({
|
|
|
353
353
|
})
|
|
354
354
|
```
|
|
355
355
|
|
|
356
|
+
## [Store data on disk as a hash table](https://presidium.services/docs/DiskHashTable)
|
|
357
|
+
```javascript
|
|
358
|
+
const DiskHashTable = require('presidium-db/DiskHashTable')
|
|
359
|
+
|
|
360
|
+
const ht = new DiskHashTable({
|
|
361
|
+
storageFilepath: '/path/to/storage-file',
|
|
362
|
+
headerFilepath: '/path/to/header-file',
|
|
363
|
+
initialLength: 1024,
|
|
364
|
+
})
|
|
365
|
+
await ht.init()
|
|
366
|
+
|
|
367
|
+
await ht.set('my-key', 'my-value')
|
|
368
|
+
|
|
369
|
+
const myValue = await ht.get('my-key')
|
|
370
|
+
console.log(myValue) // 'my-value'
|
|
371
|
+
|
|
372
|
+
await ht.delete('my-key')
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## [Store data on disk as a sorted hash table](https://presidium.services/docs/DiskSortedHashTable)
|
|
376
|
+
```javascript
|
|
377
|
+
const DiskSortedHashTable = require('presidium-db/DiskSortedHashTable')
|
|
378
|
+
|
|
379
|
+
const sortedHt = new DiskSortedHashTable({
|
|
380
|
+
storageFilepath: '/path/to/storage-file',
|
|
381
|
+
headerFilepath: '/path/to/header-file',
|
|
382
|
+
initialLength: 1024,
|
|
383
|
+
})
|
|
384
|
+
await sortedHt.init()
|
|
385
|
+
|
|
386
|
+
await sortedHt.set('first-key', 'first-value', 1)
|
|
387
|
+
await sortedHt.set('second-key', 'second-value', 2)
|
|
388
|
+
await sortedHt.set('third-key', 'third-value', 3)
|
|
389
|
+
|
|
390
|
+
for await (const value of sortedHt.forwardIterator()) {
|
|
391
|
+
console.log(value) // first-value
|
|
392
|
+
// second-value
|
|
393
|
+
// third-value
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
for await (const value of sortedHt.reverseIterator()) {
|
|
397
|
+
console.log(value) // third-value
|
|
398
|
+
// second-value
|
|
399
|
+
// first-value
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
for await (const value of sortedHt.forwardIterator({ startingSortValue: 2, endingSortValue: 3 })) {
|
|
403
|
+
console.log(value) // second-value
|
|
404
|
+
// third-value
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
for await (const value of sortedHt.reverseIterator({ startingSortValue: 2, endingSortValue: 1 })) {
|
|
408
|
+
console.log(value) // second-value
|
|
409
|
+
// first-value
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
356
413
|
## License
|
|
357
414
|
Presidium is distributed under the [CFOSS License](https://cloutsworld.com/en-us/legal/license/cfoss).
|
|
358
415
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "presidium",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "A library for creating web services",
|
|
5
5
|
"author": "Richard Tong",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "CFOSS",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"extract-zip": "^2.0.1",
|
|
66
66
|
"html-entities": "^2.6.0",
|
|
67
|
-
"presidium-db": ">=3.
|
|
67
|
+
"presidium-db": ">=3.10.0",
|
|
68
68
|
"presidium-websocket": ">=3.2.1",
|
|
69
69
|
"rubico": "^2.7.7",
|
|
70
70
|
"tar-stream": "^3.1.7"
|