{
  "name": "level-sublevel",
  "description": "Separate sections of levelup, with hooks!",
  "version": "4.4.0",
  "homepage": "https://github.com/dominictarr/level-sublevel",
  "repository": {
    "type": "git",
    "url": "git://github.com/dominictarr/level-sublevel.git"
  },
  "dependencies": {
    "level-hooks": "~4.1.3",
    "string-range": "~1.2.1",
    "level-fix-range": "~1.1.2"
  },
  "devDependencies": {
    "levelup": "~0.7.0",
    "rimraf": "~2.1.4",
    "tape": "~0.2.2",
    "shasum": "0.0.2"
  },
  "scripts": {
    "test": "set -e; for t in test/*.js; do node $t; done"
  },
  "author": {
    "name": "Dominic Tarr",
    "email": "dominic.tarr@gmail.com",
    "url": "http://dominictarr.com"
  },
  "license": "MIT",
  "stability": "unstable",
  "readme": "# level-sublevel\n\nSeparate sections of levelup, with hooks!\n\nThis module allows you to create seperate sections of a\n[levelup](https://github.com/rvagg/node-levelup) database,\nkinda like tables in an sql database, but evented, and ranged,\nfor real-time changing data.\n\n## Stability\n\nUnstable: Expect patches and features, possible api changes.\n\nThis is module is working well, but may change in the future as it's use is futher explored.\n\n## Example\n\n``` js\nvar LevelUp = require('levelup')\nvar Sublevel = require('level-sublevel')\n\nvar db = Sublevel(LevelUp('/tmp/sublevel-example'))\nvar sub = db.sublevel('stuff')\n\n//put a key into the main levelup\ndb.put(key, value, function () {\n  \n})\n\n//put a key into the sub-section!\nsub.put(key2, value, function () {\n\n})\n```\n\nSublevel prefixes each subsection so that it will not collide\nwith the outer db when saving or reading!\n\n## Hooks\n\nHooks are specially built into Sublevel so that you can \ndo all sorts of clever stuff, like generating views or\nlogs when records are inserted!\n\nRecords added via hooks will be atomically with the triggering change.\n\n### Hooks Example\n\nWhenever a record is inserted,\nsave an index to it by the time it was inserted.\n\n``` js\nvar sub = db.sublevel('SEQ')\n\ndb.pre(function (ch, add) {\n  add({\n    key: ''+Date.now(), \n    value: ch.key, \n    type: 'put'\n  }, sub) //NOTE pass the destination db to add\n          //and the value will end up in that subsection!\n})\n\ndb.put('key', 'VALUE', function (err) {\n\n  //read all the records inserted by the hook!\n\n  sub.createReadStream()\n    .on('data', console.log)\n\n})\n```\n\nNotice that `sub` is the second argument to `add`,\nwhich tells the hook to save the new record in the `sub` section.\n\n## Batches\n\nIn `sublevel` batches also support a `prefix: subdb` property,\nif set, this row will be inserted into that database section,\ninstead of the current section.\n\n``` js\nvar sub1 = db.sublevel('SUB_1')\nvar sub2 = db.sublevel('SUM_2')\n\nsub.batch([\n  {key: 'key', value: 'Value', type: 'put'},\n  {key: 'key', value: 'Value', type: 'put', prefix: sub2},\n], function (err) {...})\n```\n\n## License\n\nMIT\n\n",
  "readmeFilename": "README.md",
  "_id": "level-sublevel@4.4.0",
  "_from": "level-sublevel@~4.4.0"
}
