{"id":47524,"library":"expo-storage","title":"expo-storage","description":"A persistent key-value storage library for Expo and React Native apps that removes the size limitations of react-native AsyncStorage by using expo-file-system. Version 55.0.5 requires Expo SDK 54+, React 19+, and expo-file-system 19+. The library provides a simple, Promise-based API with TypeScript support, automatic JSON serialization for non-string values, and built-in security features like key validation and path traversal prevention. It stores data in the app's private document directory, ensuring persistence across restarts without size constraints.","status":"active","version":"55.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/echowaves/expo-storage","tags":["javascript","expo","react-native","asynch-storage","persistance","typescript"],"install":[{"cmd":"npm install expo-storage","lang":"bash","label":"npm"},{"cmd":"yarn add expo-storage","lang":"bash","label":"yarn"},{"cmd":"pnpm add expo-storage","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for file-based storage operations","package":"expo-file-system","optional":false}],"imports":[{"note":"Named export only; default import is not available and will return undefined.","wrong":"import Storage from 'expo-storage'","symbol":"Storage","correct":"import { Storage } from 'expo-storage'"},{"note":"API expects an object with key and value properties, not positional arguments.","wrong":"await Storage.setItem('k', 'v')","symbol":"Storage.setItem","correct":"await Storage.setItem({ key: 'k', value: 'v' })"},{"note":"Must pass an object with key property; returning null if key not found.","wrong":"const item = await Storage.getItem('k')","symbol":"Storage.getItem","correct":"const item = await Storage.getItem({ key: 'k' })"},{"note":"Similar to other methods, expects an object with key.","wrong":"await Storage.removeItem('k')","symbol":"Storage.removeItem","correct":"await Storage.removeItem({ key: 'k' })"},{"note":"No arguments needed; returns an array of string keys.","wrong":"const keys = await Storage.getAllKeys({})","symbol":"Storage.getAllKeys","correct":"const keys = await Storage.getAllKeys()"}],"quickstart":{"code":"import { Storage } from 'expo-storage';\n\nasync function example() {\n  try {\n    await Storage.setItem({ key: 'user', value: { name: 'Alice', age: 30 } });\n    const raw = await Storage.getItem({ key: 'user' });\n    if (raw !== null) {\n      const parsed = JSON.parse(raw);\n      console.log(parsed); // { name: 'Alice', age: 30 }\n    }\n    const keys = await Storage.getAllKeys();\n    console.log('Stored keys:', keys);\n    await Storage.removeItem({ key: 'user' });\n  } catch (error) {\n    console.error('Storage error:', error);\n  }\n}\nexample();","lang":"typescript","description":"Demonstrates basic CRUD operations: store, retrieve, list keys, and delete data using the object-parameter API."},"warnings":[{"fix":"Use { key: 'k', value: 'v' } instead of ('k', 'v') for setItem, getItem, removeItem.","message":"API uses object parameters instead of positional arguments","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Update expo-file-system to ^19.0.0 and ensure Expo SDK >= 54.","message":"In version 55, expo-storage requires expo-file-system 19+ and Expo SDK 54+. Older versions of these dependencies may cause runtime errors.","severity":"deprecated","affected_versions":">=55.0.0"},{"fix":"Validate keys with /^[a-zA-Z0-9_.-]+$/ before storing.","message":"Keys must only contain alphanumeric characters, hyphens, underscores, and dots. Invalid keys throw an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Call JSON.parse on the result of getItem if you stored a non-string value.","message":"Values are automatically serialized to JSON if not a string. When retrieving, you must manually parse the string with JSON.parse.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use import { Storage } from 'expo-storage' instead of import Storage from 'expo-storage'.","message":"No default export; only named export { Storage } is available.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'19':40,46 '54':38 '55.0.5':34 'across':92 'api':55 'app':16,85 'asynch':103 'asynch-storag':102 'asyncstorag':26 'automat':59 'base':54 'built':69 'built-in':68 'constraint':96 'data':82 'directori':89 'document':88 'ensur':90 'expo':2,12,30,36,43,98 'expo-file-system':29,42 'expo-storag':1 'featur':72 'file':31,44 'javascript':97 'json':60 'key':7,74 'key-valu':6 'librari':10,48 'like':73 'limit':21 'nativ':15,25,101 'non':64 'non-str':63 'path':77 'persist':5,91,105 'prevent':79 'privat':87 'promis':53 'promise-bas':52 'provid':49 'react':14,24,39,100 'react-nat':23,99 'remov':18 'requir':35 'restart':93 'sdk':37 'secur':71 'serial':61 'simpl':51 'size':20,95 'storag':3,9,104 'store':81 'string':65 'support':58 'system':32,45 'travers':78 'typescript':57,106 'use':28 'valid':75 'valu':8,66 'version':33 'without':94","created_at":"2026-06-07T16:51:57.061407+00:00","updated_at":"2026-06-07T16:51:57.061407+00:00","problems":[{"fix":"Change to: import { Storage } from 'expo-storage'","cause":"Using default import instead of named import.","error":"TypeError: undefined is not an object (evaluating 'Storage.setItem')"},{"fix":"Run: expo install expo-file-system or ensure version ^19.0.0 is installed.","cause":"Missing or incompatible peer dependency expo-file-system.","error":"Invariant Violation: The module 'expo-file-system' is not installed"},{"fix":"Use only alphanumeric, hyphen, underscore, and dot characters. Avoid '../' or '/'. Example: 'user-preferences'","cause":"Key contains invalid characters or path traversal attempt.","error":"Error: Invalid storage key: 'path/../traversal'"},{"fix":"Wrap in object: { key: 'k', value: 42 } instead of Storage.setItem({ key: 'k', value: 42 }) is actually correct. If error persists, check value is not undefined.","cause":"Passing a primitive number without object wrapper.","error":"Error: The provided value must be a string or object. Received: number"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/echowaves/expo-storage#readme","github":"https://github.com/echowaves/expo-storage","docs":null,"changelog":null,"pypi":null,"npm":"expo-storage","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}