https://github.com/JamesKyburz/leveldb-mount
leveldb with backend + optional repl built with subleveldown and multileveldown.
https://github.com/JamesKyburz/leveldb-mount
Last synced: 4 months ago
JSON representation
leveldb with backend + optional repl built with subleveldown and multileveldown.
- Host: GitHub
- URL: https://github.com/JamesKyburz/leveldb-mount
- Owner: JamesKyburz
- License: other
- Created: 2015-12-01T19:27:36.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T17:22:18.000Z (almost 5 years ago)
- Last Synced: 2024-11-02T02:06:12.525Z (4 months ago)
- Language: JavaScript
- Homepage: http://npm.im/leveldb-mount
- Size: 525 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.markdown
- License: LICENSE
Awesome Lists containing this project
README
# leveldb-mount
leveldb with backend + optional repl built with [subleveldown] and [multileveldown].
[](https://github.com/feross/standard)
[](https://greenkeeper.io/)# server
server.js
```javascript
var leveldb = require('leveldb-mount')
leveldb.server(httpServer, opt) // see options
````server+repl`
```javascript
var leveldb = require('leveldb-mount')
leveldb.server(port, opt) // see options
```Note if no credentials are given the repl is not available.
# client
browserifying this module gives you a client
see examples
# routes
routes.js using [http-hash] (but can use router of choice)
```javascript
var leveldb = require('leveldb-mount')
var routes = leveldb.routes(opt) // see options
router.set('/repl.html', routes.html)
router.set('/repl.js', routes.js)
```# db
```javascript
var db = leveldb.db(opt) // see options
var inbox = db.namespace('inbox')
inbox.set...
db.set...
```# optional repl
navigation to /repl.html and `window.db` and `window.sublevel` will now be set.# options
```javascript
var opt = {
dbPath: 'path',
replCredentials: 'user:pass',
encoding: {
keyEncoding: 'utf8',
valueEncoding: 'json'
}
}
```* `opt.replCredentials` is only needed if you want the repl.
* `opt.encoding` defaults to `utf8` for keys and `json` for values.
* `opt.dbPath` has to contain a value.
* `opt.auth` optional auth function (request, cb).`encoding` is passed to the repl!
# example
```
npm install concat-stream
node example/index.js
```[http-hash]: https://github.com/Matt-Esch/http-hash
[subleveldown]: https://github.com/mafintosh/subleveldown
[multileveldown]: https://github.com/mafintosh/multileveldown