leveldb
https://github.com/google/leveldb
key-value型のデータベース。上記はC++のスタティックライブラリを作成する。
VisualStudio2019でビルドする方法
1.22の場合は以下を実行してエラーにさせる
cmake -G "Visual Studio 16"
CMakeCache.txtを書き換える
code:CMakeChache.txt
CMAKE_GENERATOR:INTERNAL=Visual Studio 16 2019
下記のコマンド実行でleveldb.slnが作られる
cmake -G "Visual Studio 16"
※GitHubの最新コードをとるとVisual Studio2019に対応してそうな感じ
Uiで操作できんの?
有償のやつはあったけど、無償のやつはなさそう。
Pythonの操作
Windowsだときびしい
Node.jsの操作
ChromeのLocalStorageを確認してみる。
npm install levelup
npm install leveldown
code:コード例
var levelup = require('levelup')
var leveldown = require('leveldown')
// chrome開いているとエラーになる
var db = levelup(leveldown('C:/Users/ユーザ名/AppData/Local/Google/Chrome/User Data/Default/Local Storage/leveldb'))
/*
db.put('name', 'levelup', function (err) {
if (err) return console.log('Ooops!', err) // some kind of I/O error
// 3) Fetch by key
db.get('name', function (err, value) {
if (err) return console.log('Ooops!', err) // likely the key was not found
// Ta da!
console.log('name=' + value)
})
})
*/
db.createReadStream()
.on('data', function (data) {
console.log(data.key, data.key.toString(), '=', data.value, 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')
})
testData->test,testData2->ああああを登録したケースだと以下のような感じで登録されているっぽいが詳細不明
<Buffer 5f 68 74 74 70 3a 2f 2f 6e 65 65 64 74 65 63 2e 73 61 6b 75 72 61 2e 6e 65 2e 6a 70 00 01 74 65 73 74 44 61 74 61> '_http://needtec.sakura.ne.jp\u0000\u0001testData' '=' <Buffer 01 74 65 73 74> '\u0001test'
<Buffer 5f 68 74 74 70 3a 2f 2f 6e 65 65 64 74 65 63 2e 73 61 6b 75 72 61 2e 6e 65 2e 6a 70 00 01 74 65 73 74 44 61 74 61 32> '_http://needtec.sakura.ne.jp\u0000\u0001testData2' '=' <Buffer 00 42 30 42 30 42 30 42 30> '\u0000B0B0B0B0'
詳細はこのあたりか?
https://docs.google.com/document/d/18wpuaitdvki6mO4aWkjvORgryUHM-mvDIqppDXhbSTk/edit
https://stackoverflow.com/questions/46325138/local-storage-with-chrome-61