Installations
npm install @piotr-cz/redux-persist-idb-storage
Developer
piotr-cz
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
14.17.5
NPM Version
6.14.14
Statistics
26 Stars
69 Commits
4 Forks
2 Watching
2 Branches
2 Contributors
Updated on 09 Oct 2024
Languages
TypeScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
208,335
Last day
16.1%
361
Compared to previous day
Last week
2.3%
1,578
Compared to previous week
Last month
20.1%
7,146
Compared to previous month
Last year
27.2%
55,212
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Redux Persist adapter for IndexedDB storage
Storage adapter to use IndexedDB via idb v3 with redux-persist ripped from idb v3 docs > Examples section
Installation
Using npm:
1npm install --save @piotr-cz/redux-persist-idb-storage
or Yarn:
1yarn add @piotr-cz/redux-persist-idb-storage
Requirements
- Promise support/ polyfill
Setup
Import the storage and include it in persistConfig
when creating Redux store:
1// configureStore.js 2 3import createIdbStorage from '@piotr-cz/redux-persist-idb-storage' 4 5const persistConfig = { 6 key: 'root', 7 storage: createIdbStorage({name: 'myApp', storeName: 'keyval'}), 8 serialize: false, // Data serialization is not required and disabling it allows you to inspect storage value in DevTools; Available since redux-persist@5.4.0 9 deserialize: false, // Required to bear same value as `serialize` since redux-persist@6.0 10} 11 12// ...
Server-Side Rendering
When using Server-Side Rendering (SSR), indexedDB won't be available in the environment.
In this case you may use feature detection with a fallback to use default redux-persist storage (which resolves to noop functions):
1// configureStore.js 2 3// Redux Persist storage 4import defaultStorage from 'redux-persist/lib/storage' 5 6// IndexedDB storage 7import createIdbStorage from '@piotr-cz/redux-persist-idb-storage/src' 8 9const persistConfig = { 10 key: 'root', 11 storage: globalThis.indexedDB ? createIdbStorage({name: 'myApp', storeName: 'keyval'}) : defaultStorage, 12 serialize: false, 13}
Options
See idb API
name
(optional): IndexedDB Database name. Defaults to'keyval-store'
.storeName
(optional): IndexedDB Store name. Defaults to'keyval'
.version
(optional): Schema version. Defaults to1
.upgradeCallback
(optional): Defaults toupgradeDb => upgradeDb.createObjectStore(options.storeName)
.
Notes
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 18 are checked with a SAST tool
Score
2.8
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More