juliangruber/multilevel — pull request #8 by dominictarr (2013-04-13 22:37:18+00:00)
Title: support sublevel and plugin extensions

This pull request allows multilevel to support sublevels, and plugins.

You just have to pass a [manifest](https://github.com/dominictarr/level-manifest) from the server to the client multilevel:

``` js
var db = levelup(path)
sublevel(db)

//setup db...

var foo = MapReduce(db, 'map',...) //etc

fs.writeFileSync(JSON.stringify(manifest(db, true)), './manifest.json'))

//later...

stream.pipe(multilevel.server(db)).pipe(stream)
```

and then the client browserifys that in.

``` js
stream.pipe(multilevel.client(db, require('./manifest.json'))).pipe(stream)
```
If you don't provide a manifest you will still be able to use the normal methods on the base level.

This will work great if you have browserify setup to generate lazily,
on the first request, as that will mean the `manifest.json` is surely generated before browserify is run.

I'm making this pull request as a work in progress, I've disabled events,
and the tests that need them. Am also considering some way to add functions to the manifest, for cases where you need some piece of code to run on the front and the back-end. this would be very handy for scuttlebutts.