A lightweight browser library for type-safe, versioned JSON storage via localStorage. v4.0.15 (last release 2024) targets Node ≥20 and is ESM-only with bundled TypeScript and Flow typings. Key differentiator: automatic purging on schema version bumps, with optional migration support. Minimal API: one class (Storage) with read/write/reset. Dependencies: none.
npm install versioned-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creation of versioned storages, writing/reading data, automatic purge on version change, TypeScript generics, and global reset.
Replace require('versioned-storage') with import { Storage } from 'versioned-storage'.Upgrade Node.js to version 20 or later.
Upgrade to latest version to ensure all APIs are available.
Always provide a version number to avoid unexpected data retention.
Ensure all stored values are JSON-compatible (strings, numbers, booleans, objects, arrays, null).
Change require('versioned-storage') to import { Storage } from 'versioned-storage'.Use named import: import { Storage } from 'versioned-storage'.Ensure you have imported Storage correctly and created an instance: const userStorage = new Storage('user', 1);No dependency data recorded yet.