dht-keyvalue
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "dht-keyvalue", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Store key-value pairs on the mainline bittorrent DHT network, and retreive/update them by key name.", | ||
@@ -5,0 +5,0 @@ "main": "server.js", |
@@ -34,13 +34,15 @@ # dht-keyvalue | ||
## `dkv.put([items], [callback])` | ||
`items` is an array of items with the following structure: | ||
### `dkv.put([items], [callback])` | ||
Put a record or multiple records on DHT. `items` is an array of items with the following structure: | ||
```js | ||
[ { key: 'keyname', value: 'value' }, { ... }, { ... } ] | ||
``` | ||
`callback` returns the DHT `hash` of the announced item and its `key` name. | ||
## `dkv.get(key, [callback])` | ||
Lookup an item stored on DHT. `callback` returns the item's `key` name and `value`. | ||
### `dkv.get(key, [callback])` | ||
Get an item stored on DHT by `key`. `callback` returns the item's `key` name and the DHT object's `value`. | ||
## `dkv.update(key, newValue, [callback])` | ||
### `dkv.update(key, newValue, [callback])` | ||
Update an item in DHT by key name. `callback` returns `true` when the update on DHT was successful. | ||
@@ -51,3 +53,3 @@ | ||
## Examples | ||
### Put, get, update one record on DHT | ||
### One record: put, get, update on DHT | ||
```js | ||
@@ -78,3 +80,3 @@ let item = [ | ||
``` | ||
### Put, get, update multiple records on DHT | ||
### Multiple records: put, get, update on DHT | ||
```js | ||
@@ -81,0 +83,0 @@ let items = [ |
8523
106