LevelDb.Managed
1.0.0
See the version list below for details.
dotnet add package LevelDb.Managed --version 1.0.0
NuGet\Install-Package LevelDb.Managed -Version 1.0.0
<PackageReference Include="LevelDb.Managed" Version="1.0.0" />
<PackageVersion Include="LevelDb.Managed" Version="1.0.0" />
<PackageReference Include="LevelDb.Managed" />
paket add LevelDb.Managed --version 1.0.0
#r "nuget: LevelDb.Managed, 1.0.0"
#:package LevelDb.Managed@1.0.0
#addin nuget:?package=LevelDb.Managed&version=1.0.0
#tool nuget:?package=LevelDb.Managed&version=1.0.0
LevelDb.Managed
A pure managed .NET library for reading and writing LevelDB databases - no native binaries, no P/Invoke - with a Chromium layer on top for the stores Chromium-based apps (Chrome, Electron, CEF) keep on disk.
Two packages:
- LevelDb.Managed - the LevelDB format itself: reading live databases lock-free (log, sstables, MANIFEST, correct newest-wins merge semantics), append-only writing via
WriteBatch, and a raw record layer that surfaces superseded and deleted records for forensic use. - LevelDb.Managed.Chromium - Chromium's Local Storage on top of it: per-storage-key string key/value access, handling Chromium's key layout and value encodings.
Installation
dotnet add package LevelDb.Managed
dotnet add package LevelDb.Managed.Chromium
LevelDb.Managed.Chromium depends on LevelDb.Managed, so for Local Storage work the second command is all you need.
Usage
Reading a LevelDB database
using LevelDbManaged;
using ReadOnlyLevelDb db = LevelDb.OpenReadOnly(@"path\to\leveldb");
byte[]? value = db.Get("some-key"u8);
foreach ((byte[] key, byte[] val) in db.Enumerate())
{
// newest-wins view of the current database state
}
Writing
using LevelDbManaged;
using LevelDb db = LevelDb.Open(@"path\to\leveldb");
WriteBatch batch = new();
batch.Put("key"u8, "value"u8);
batch.Delete("old-key"u8);
db.Write(batch);
Chromium Local Storage
using LevelDbManaged.Chromium;
using ReadOnlyLocalStorageStore store =
LocalStorageStore.OpenReadOnly(@"...\User Data\Default\Local Storage\leveldb");
foreach (string storageKey in store.EnumerateStorageKeys())
{
IReadOnlyDictionary<string, string> items = store.GetItems(storageKey);
}
Writing works the same way through LocalStorageStore.Open and PutItems.
Raw records (forensics)
using LevelDbManaged;
LevelDbRecordReader reader = new(@"path\to\leveldb");
foreach (LevelDbRecord record in reader.ReadRecords())
{
// every record in the store, including superseded and deleted ones,
// with sequence number, operation, and source file
}
Safety model
- Reading never takes the LevelDB lock and is safe while the owning app has the store open; slightly stale data is possible.
- Writing appends to the active log and requires the owning app to be closed.
Scope
Reading covers the full live file set (CURRENT, MANIFEST, write-ahead log, .ldb sstables with snappy compression). Writing is append-only: put/delete batches framed onto the active log, replayed by LevelDB/Chromium on next open - no sstable authoring, no compaction. The comparator is pluggable (bytewise by default). IndexedDB decoding is not included.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Snappier (>= 1.3.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on LevelDb.Managed:
| Package | Downloads |
|---|---|
|
LevelDb.Managed.Chromium
Chromium Local Storage decoding on top of LevelDb.Managed - string key/value access per storage key to the Local Storage stores of Chrome, Electron, and CEF apps. |
GitHub repositories
This package is not used by any popular GitHub repositories.