
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
better-local-storage-fallback
Advanced tools
Forked from ripeworks/local-storage-fallback, to allow localStorage with fallback support. This library is extended to support a unified interface for all 4 storage mechanisms (localStorage, sessionStorage, cookies, memory), with some other improvements.
Forked/originally from @ripeworks/local-storage-fallback.
$ npm install rw3iss/better-local-storage-fallback
import storage from 'better-local-storage-fallback' // if you use es6 or typescript
// use object destructuring when using require()
// const {storage} = require('better-local-storage-fallback')
// Use storage directly
storage.setItem('foo', 'bar');
storage.getItem('foo'); // bar
// Or shim window.localStorage
if (!('localStorage' in window)) {
window.localStorage = storage;
}
(TODO)
<script src="https://unpkg.com/better-local-storage-fallback/lib/dist.min.js"></script>
<script>
window.localStorageFallback.setItem('foo', 'bar')
</script>
With browser settings like "Private Browsing" it has become a problem to rely on a working window.localStorage, even in newer browsers. Even though it may exist, it will throw exceptions when trying to use setItem or getItem. This module will run appropriate checks to see what browser storage mechanism might be available, and then expose it. It uses the same API as localStorage so it should work as a drop-in replacement in most cases.
CookieStorage has storage limits. Be careful here.MemoryStorage will not persist between page loads. This is more or less a stop-gap to prevent page crashes, but may be sufficient for websites that don't do full page loads.FAQs
Forked from ripeworks/local-storage-fallback, to allow localStorage with fallback support. This library is extended to support a unified interface for all 4 storage mechanisms (localStorage, sessionStorage, cookies, memory), with some other improvements.
We found that better-local-storage-fallback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.