Skip to content

Commit

Permalink
added utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Dec 28, 2011
1 parent 6ed8e9d commit bd5a6ed
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bin/gdbm-fetch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node
"use strict";
var gdbm = require('gdbm'),
util = require('util'),
undefined;

console.log(process.argv);
if (process.argv.length !== 4) {
util.puts("Usage: gdbm-fetch path key");
process.exit(1);
}
var path = process.argv[2];
var key = process.argv[3];

var db = new gdbm.GDBM();
if (!db.open(path, 0, gdbm.GDBM_READER)) {
throw db.strerror();
}
util.puts(db.fetch(key));
22 changes: 22 additions & 0 deletions bin/gdbm-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env node
"use strict";
var gdbm = require('gdbm'),
util = require('util'),
undefined;

console.log(process.argv);
if (process.argv.length !== 3) {
util.puts("Usage: gdbm-list path");
process.exit(1);
}
var path = process.argv[2];

var db = new gdbm.GDBM();
if (!db.open(path, 0, gdbm.GDBM_READER)) {
throw db.strerror();
}
var key = db.firstkey();
while (key) {
console.log(key);
key = db.nextkey(key);
}

0 comments on commit bd5a6ed

Please sign in to comment.