Skip to content
This repository was archived by the owner on Dec 2, 2024. It is now read-only.
/ party Public archive

Commit f0d7f73

Browse files
author
James Halliday
committed
passing bytewise get/put
1 parent daec7b6 commit f0d7f73

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

test/bytewise.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var test = require('tape');
2+
var level = require('../');
3+
var path = require('path');
4+
var bytewise = require('bytewise');
5+
var os = require('os');
6+
var tmpdir = os.tmpdir ? os.tmpdir() : os.tmpDir();
7+
var datadir = path.join(tmpdir, 'level-party-' + Math.random());
8+
9+
var lopts = { keyEncoding: bytewise, valueEncoding: 'json' };
10+
11+
test('two handles', function (t) {
12+
t.plan(1);
13+
var adb = level(datadir, lopts);
14+
var bdb = level(datadir, lopts);
15+
var value = Math.floor(Math.random() * 100000);
16+
17+
adb.put([ 'a' ], value, function (err) {
18+
if (err) t.fail(err);
19+
var times = 0;
20+
21+
bdb.get([ 'a' ], function (err, x) {
22+
t.equal(x, value);
23+
});
24+
});
25+
26+
t.on('end', function () {
27+
adb.close();
28+
bdb.close();
29+
});
30+
});

0 commit comments

Comments
 (0)