An in-memory implementation of the W3C Storage Interface (localStorage/sessionStorage) for use as a shim in Node.js environments, primarily for unit testing. v2.0.1 (March 2020) is the latest stable release. It uses Proxy (since v2.0.0) to allow direct property access while maintaining the storage API. It does not persist data to disk and does not implement the 'storage' event. Lightweight, TypeScript declarations included.
npm install node-storage-shimNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creation of a StorageShim instance, basic set/get/remove operations, and polyfilling localStorage/sessionStorage in Node.js.
Upgrade Node to >=6.14.4 and test code that iterates over storage keys or directly accesses properties.
Avoid using keys that conflict with Storage interface method names.
Manually mock the storage event or use a different shim that supports it.
Do not use for production persistence; use a real localStorage/sessionStorage or a persistent store instead.
Ensure tsconfig includes node_modules types. Import using default import syntax.
Run `npm install node-storage-shim --save-dev` or check the import statement.
Use `const StorageShim = require('node-storage-shim')` in CommonJS or `import StorageShim from 'node-storage-shim'` in ESM.Always use `new StorageShim()` to create an instance.
No dependency data recorded yet.