Skip to main content

decode_localstorage_value

Function decode_localstorage_value 

Source
pub fn decode_localstorage_value(blob: &[u8]) -> LocalStorageValue
Expand description

Decode a WebKit/Chromium Local Storage ItemTable.value BLOB to a String.

A .localstorage file is a standard SQLite database this crate already reads; the one artifact-specific quirk is that the value column is a BLOB holding the string as raw UTF-16 little-endian code units — no BOM, no type-prefix byte — so a normal dump surfaces it as opaque hex. This turns such a BLOB back into readable text.

Panic-free and lossy-by-report: an odd-length BLOB (a trailing half code unit) or an unpaired surrogate yields U+FFFD and sets LocalStorageValue::lossy rather than erroring or panicking. An empty BLOB decodes to the empty string with lossy == false.