Registry / storage / redux-persist-fs-storage

redux-persist-fs-storage

JSON →
library1.3.0jsnpmunverified

Redux Persist FS Storage provides a storage engine for Redux Persist using React Native's file system via react-native-fs. Version 1.3.0 is the latest stable release; the package is updated infrequently as needed. It supports both Redux Persist v4 and v5, offering a straightforward adapter between react-native-fs and redux-persist. Compared to alternatives like redux-persist-filesystem-storage, this library allows custom storage directories and exposes constants like CacheDir for cache paths. Requires react-native and react-native-fs to be natively linked.

npm install redux-persist-fs-storage
INSTALL
IMPORT
SIG · REDUX-PERSIST-FS-S
R
redux-persist-fs-storage
storagejavascriptv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FSStorage
import FSStorage from 'redux-persist-fs-storage'
const { FSStorage } = require('redux-persist-fs-storage')
Default export; named import will fail.
CacheDir
import FSStorage, { CacheDir } from 'redux-persist-fs-storage'
import { CacheDir } from 'redux-persist-fs-storage'
CacheDir is a named export, but default import FSStorage must be separate.
DocumentDir
import FSStorage, { DocumentDir } from 'redux-persist-fs-storage'
Named export for document directory constant.

Configures Redux Persist v5 with file system storage using default settings.

import { createStore } from 'redux'; import { persistStore, persistReducer } from 'redux-persist'; import FSStorage from 'redux-persist-fs-storage'; const persistConfig = { key: 'root', keyPrefix: '', storage: FSStorage(), }; const rootReducer = (state = {}) => state; const persistedReducer = persistReducer(persistConfig, rootReducer); const store = createStore(persistedReducer); const persistor = persistStore(store); export { store, persistor };
Debug
Known issues
gotchaIf you do not set keyPrefix to empty string, Redux Persist defaults to 'persist:' which may cause issues with some file systems (e.g., special characters in filenames).
fix
Set keyPrefix: '' in persistConfig.
affects: >=1.0.0
deprecatedRedux Persist v4 is no longer actively maintained; FSStorage still supports it but users should migrate to v5.
fix
Upgrade to redux-persist v5 and use persistReducer/persistStore as shown.
affects: >=1.0.0
gotchareact-native-fs must be natively linked after installation; otherwise the storage engine will fail silently.
fix
Run 'react-native link react-native-fs' or manually link for iOS/Android.
affects: >=1.0.0
gotchaFSStorage() must be called as a function; passing the class itself will cause errors.
fix
Use FSStorage() instead of FSStorage.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: FSStorage is not a function
Importing FSStorage as a named export instead of default.
fix
Use 'import FSStorage from 'redux-persist-fs-storage''.
Error: RNFS is not defined
react-native-fs not linked or imported.
fix
Run 'react-native link react-native-fs' and ensure NativeModules.RNFS exists.
Warning: persistReducer: Unknown persist state action
Combining FSStorage with redux-persist incorrectly (e.g., missing persistReducer).
fix
Use persistReducer as shown in the quickstart.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
react-nativerequiredPeer dependency; required for React Native environment.
react-native-fsrequiredRequired at runtime for file system operations.
redux-persistrequiredRuntime peer dependency; the library is a storage engine for redux-persist.
Agent activity
23 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
redux-persist-fs-storage — npm install redux-persist-fs-storage · libregistry