Skip to content

Commit

Permalink
Added dump-leveldb script (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris White committed Mar 16, 2019
1 parent 1d121f4 commit 29e2912
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ core
*.stackdump
/*_history
tags
/webstore*.zip
*.zip
foo.*

# Output directories
Expand Down
33 changes: 33 additions & 0 deletions tools/dump-leveldb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// dump-leveldb.js: Dump the data from a Chrome/Vivaldi
// Extension Settings database.
//
// See https://github.com/cxw42/TabFern/issues/170#issuecomment-473280320
// for usage instructions.
//
// Prerequisites:
// npm install levelup leveldown
//
// This code by cxw42 2019, CC-BY-SA 3.0. Thanks to the sample at
// https://github.com/Level/levelup/blob/master/README.md and to
// https://superuser.com/a/1088579/269989 by
// https://superuser.com/users/219095/daniel-b

var levelup = require('levelup')
var leveldown = require('leveldown')

// 1) Create our store
var db = levelup(leveldown('./data'))

db.createReadStream()
.on('data', function (data) {
console.log(data.key.toString('utf8'), '=', data.value.toString('utf8'))
})
.on('error', function (err) {
console.log('Oh my!', err)
})
.on('close', function () {
console.log('Stream closed')
})
.on('end', function () {
console.log('Stream ended')
});

0 comments on commit 29e2912

Please sign in to comment.