A lightweight browser-side web storage wrapper for localStorage and sessionStorage with TTL (time-to-live) support. Version 1.3.0 is the current stable release; the package sees infrequent updates. It differentiates from bare Web Storage API by adding automatic expiration of stored items, configurable in milliseconds, seconds, minutes, hours, or days, with optional automatic TTL refresh on get. Supports both LocalStorage and SessionStorage with a consistent API.
npm install storage-managerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use LocalStorage with TTL, get, remove, clearAll, and SessionStorage.
Pass { minutes: 2, refreshTTL: false } to set() if you want the TTL to count down from the initial set time without refreshing.Always check for browser environment before using, e.g., if (typeof window !== 'undefined'). Consider using a polyfill or conditional import.
Create a .d.ts file: declare module 'storage-manager' { export class LocalStorage { ... } }Ensure code runs only in browser: if (typeof window !== 'undefined') { LocalStorage.set('key', 'value'); }Use only: 'milliseconds', 'seconds', 'minutes', 'hours', 'days'.
Use: import { LocalStorage } from 'storage-manager'No dependency data recorded yet.