Skip to content

Commit

Permalink
sublevel example
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Feb 28, 2014
1 parent f8b1f5b commit 28b8bc4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions example/sublevel/batch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var level = require('../');
var sublevel = require('level-sub');
var db = sublevel(level('/tmp/db', { encoding: 'json' }));
db.sublevel('xxx').batch([
{ type: 'put', key: Math.random(), value: Math.random() },
{ type: 'put', key: Math.random(), value: Math.random() },
{ type: 'put', key: Math.random(), value: Math.random() },
{ type: 'put', key: Math.random(), value: Math.random() }
]);
7 changes: 7 additions & 0 deletions example/sublevel/x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var level = require('../');
var sublevel = require('level-sub');
var db = sublevel(level('/tmp/db', { encoding: 'json' }));
var xxx = db.sublevel('xxx');
xxx.createReadStream().on('data', function (row) {
console.log(row);
});

0 comments on commit 28b8bc4

Please sign in to comment.