v0.1.1
MIT
zero deps
bundle: checking…
Browser Persistence Suite

Durable writes.
Crash recovery.
Form state that sticks.

Three coordinated layers — spirit, saveNative, bridge — solving write ordering, process lifecycle, and I/O durability inside a browser tab. No server. No Electron wrapper kindly asking if that's okay.

File System Access API
IndexedDB
Write-ahead shelf
Chromium FS · all browsers for spirit
01 gnoke-spirit — form state survival

Type in the fields. Kill the tab. Come back. Your work is here. Spirit debounces saves to IndexedDB on every keystroke and force-saves on visibilitychange. Password fields are never touched.

spirit.wake()
idle
sensitive field — never persisted
spirit events

Every save, restore, and field exclusion logged in real time. Watch it react as you type — or switch to another tab.

wake spirit to begin
02 gnoke-savenative — durable disk writes

Mount a local folder. Writes are serialised per filename and backed by a write-ahead shelf. Kill the process mid-write and replay on next wake() — nothing is lost.

saveNative.write()
no folder mounted
I/O events

Successful writes, shelf fallbacks, and flush recoveries appear here. The shelf is the write-ahead buffer — your crash safety net.

mount a folder to begin (Chromium only)
03 web2diskbridge — full lifecycle

One wake() call restores form state, re-acquires the directory handle, flushes shelved writes, and attaches a permission watcher. This is the recommended integration point.

bridge.wake() → bridge.write() → Gnoke.inspect()
not woken
press bridge.wake() to begin
04 usage
integration.js
// load the bundle
// <script src="gnoke-persist.js"></script>
// if (!window.__GNOKE_READY__) throw new Error('Gnoke not loaded');

// provide an openDB adapter — idb or native (see examples/opendb-native.js)
import { openDB } from 'idb';

// mount once — user picks a folder
await Gnoke.bridge.mount(openDB);

// every page load after that
Gnoke.bridge.onPermissionLost     = () => showBanner('permission lost');
Gnoke.bridge.onPermissionRestored = () => hideBanner();
Gnoke.bridge.onFlushComplete      = n  => toast(`recovered ${n} writes`);

await Gnoke.bridge.wake(openDB, { formEl: document.querySelector('form') });
await Gnoke.bridge.write('output.json', JSON.stringify(data));

console.log(Gnoke.inspect());
// → { woken: true, hasWorkspace: true, permission: true, shelfFailures: 0 }
05 architecture

Each layer is independently usable. The bundle is convenience, not a requirement.

caller
web2diskbridge
wake-once · permission watch · onPermissionLost/Restored · reset()
orchestrates ↓
form state
gnoke-spirit
capture · restore · debounced save · sensitive exclusion · IndexedDB
orchestrates ↓
I/O + shelf
gnoke-savenative
per-file queue · write-ahead shelf · flush on wake · File System Access API