Registry / storage / redux-persist-filesystem-storage

redux-persist-filesystem-storage

JSON →
library4.2.0jsnpmunverified

A storage adaptor for redux-persist that uses react-native-blob-util to store Redux state on the filesystem in React Native apps. Version 4.2.0 works with redux-persist v6 and above. It is an alternative to AsyncStorage, particularly useful on Android to avoid storage size limitations. The library implements the standard redux-persist storage interface (setItem, getItem, removeItem, getAllKeys, clear) and supports custom storage paths, encoding, and file name transforms. It requires react-native-blob-util as a native dependency, and v2+ drops support for React Native <0.60.

npm install redux-persist-filesystem-storage
INSTALL
IMPORT
SIG · REDUX-PERSIST-FILE
R
redux-persist-filesystem-storage
storagejavascriptv4.2.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.

FilesystemStorage
import FilesystemStorage from 'redux-persist-filesystem-storage'
import { FilesystemStorage } from 'redux-persist-filesystem-storage'
This package exports a default export, not a named export. Do not destructure.
FilesystemStorage.config
FilesystemStorage.config({ storagePath: '/custom/path' })
config({ storagePath: '/custom/path' })
config is a method on the FilesystemStorage instance, not a separate import.
require
const FilesystemStorage = require('redux-persist-filesystem-storage').default
In CJS, you must require the default property because the package is ESM-first. Otherwise it will be undefined.

Shows how to configure redux-persist with FilesystemStorage as the storage backend.

import FilesystemStorage from 'redux-persist-filesystem-storage'; import { persistStore, persistReducer } from 'redux-persist'; import { createStore } from 'redux'; const persistConfig = { key: 'root', storage: FilesystemStorage, }; const rootReducer = (state = { counter: 0 }, action) => { switch (action.type) { case 'INCREMENT': return { counter: state.counter + 1 }; default: return state; } }; const persistedReducer = persistReducer(persistConfig, rootReducer); const store = createStore(persistedReducer); const persistor = persistStore(store); export { store, persistor };
Debug
Known issues
breakingv2 drops support for React Native < 0.60. Install v1.x for older RN versions.
fix
Use 'redux-persist-filesystem-storage@1' or upgrade React Native to 0.60+.
affects: >=2.0.0
gotchaDefault export is not a named export. Using named import results in undefined.
fix
Use default import: import FilesystemStorage from 'redux-persist-filesystem-storage'
affects: >=2.0.0
gotchaFor CJS require, you must use .default.
fix
const FilesystemStorage = require('redux-persist-filesystem-storage').default;
affects: >=2.0.0
deprecatedThe filesystem storage path must be writable. On recent Android versions, scoped storage may restrict access.
fix
Use a path inside the app's document directory (the default) and ensure proper permissions.
affects: >=2.0.0
gotchaIf using redux-persist v5, the persistStore API differs. This package works with v6+.
fix
Upgrade to redux-persist v6 or later, or see migration guide in README.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: undefined is not an object (evaluating 'FilesystemStorage.setItem')
Importing named export instead of default export.
fix
Use: import FilesystemStorage from 'redux-persist-filesystem-storage';
Module not found: Can't resolve 'react-native-blob-util'
Missing native dependency. react-native-blob-util must be installed and linked.
fix
Run: npm install react-native-blob-util && cd ios && pod install
Error: ENOENT: no such file or directory, open '/persistStore/...'
The configured storagePath does not exist or is not writable.
fix
Ensure the storagePath directory exists, or rely on the default path. Use FilesystemStorage.config({ storagePath: '...' }) with a valid path.
Upgrade
Version history
4.2.0latest on npm
Audit
Dependencies
react-native-blob-utilrequiredrequired for filesystem access
redux-persistoptionalrequired to use the storage adaptor
Agent activity
22 hits · last 30 days
node
18
Amazon
1
Resources
redux-persist-filesystem-storage — npm install redux-persist-filesystem-storage · libregistry