Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hackergrrl committed May 23, 2020
1 parent a0a5e03 commit e6052a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Core database, replication, swarming, and chat APIs for cabal.

> var Cabal = require('cabal-node')
### var cabal = Cabal([storage][, uriString][, opts])
### var cabal = Cabal([storage][, key][, opts])

Create a cabal p2p database using storage `storage`, which must be either a
string (filepath to directory on disk) or an instance of
[random-access-storage](https://github.com/random-access-storage/).

`uriString` is a cabal URI string, of the form `cabal://<hexkey>[?param1=value1&param2=value2`. A hexidecimal key on its own will also be understood.
`key` is a cabal key, as a string or Buffer.

If this is a new cabal, `key` can be omitted and will be generated.

Expand All @@ -28,6 +28,11 @@ var level = require('level')
var cabal = Cabal(storage, key, { db: level('/tmp/bot.db') })
```

Other `opts` include:

- `opts.modKeys`: an array of keys to be considered moderators from this user's perspective.
- `opts.adminKeys`: an array of keys to be considered administrators from this user's perspective.

### cabal.getLocalKey(cb)

Returns the local user's key (as a hex string).
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports.databaseVersion = DATABASE_VERSION
* local nickname -> mesh interactions for a single user.
* @constructor
* @param {string|function} storage - A hyperdb compatible storage function, or a string representing the local data path.
* @param {string} key - a protocol string, optionally with url parameters
* @param {string|Buffer} key - a hypercore public key
*/
function Cabal (storage, key, opts) {
if (!(this instanceof Cabal)) return new Cabal(storage, key, opts)
Expand Down

0 comments on commit e6052a4

Please sign in to comment.