@jafferson/simple-local-storage
v1.0.4
Published
javascript module to serve as an alternative to async storage
Downloads
8
Readme
Simple Local Storage
Simple Local Storage is a JavaScript module that provides a straightforward alternative to async storage. This module simplifies the process of storing and retrieving data locally in your web or mobile applications. It is particularly useful for projects using frameworks like React Native or Expo.
Installation
You can install Simple Local Storage via npm or yarn:
npm install @jafferson/simple-local-storage
# or
yarn add @jafferson/simple-local-storage
Usage
Here's a quick example of how to use Simple Local Storage in your JavaScript or TypeScript project:
import Storage from '@jafferson/simple-local-storage';
// Store data
Storage.setItem('myKey', 'myValue');
// Retrieve data
const myValue = Storage.getItem('myKey');
console.log(myValue); // 'myValue'
// Remove data
Storage.removeItem('myKey');
// get all keys
const allKeys = Storage.getAllKeys();
allKeys.forEach(key => { Storage.removeItem(key) }) //remove all keys
API
setItem(key: string, value: any): void
Stores the specified value under the given key.
getItem(key: string): string | null
Retrieves the value associated with the specified key.
removeItem(key: string): void
Removes the item associated with the specified key.
getAllKeys(): string[]
get all keys from the storage.
Issues
If you encounter any issues or have suggestions for improvements, please report them on GitHub Issues.
License
Simple Local Storage is released under the MIT License.
Author
- Jafferson Oliveira
- Email: [email protected]
Acknowledgments
This project relies on the expo-file-system library.
More Information
For more information and detailed examples, visit the GitHub repository or NPM page.
Thank you for using Simple Local Storage! We hope it simplifies your data storage needs in your projects. If you find it helpful, please consider giving it a star on GitHub.