vault
vault
is a sophisticated browser-based storage library that leverages the power of IndexedDB, offering significant improvements over traditional LocalStorage. As a high-performance, asynchronous solution for client-side storage, vault
provides an intuitive and easy-to-use API to interact with IndexedDB, making client-side data storage efficient and scalable.
Features
- Simple API: Easy-to-use asynchronous methods for common IndexedDB operations.
- Proxy-based Access: Intuitive syntax for data manipulation using JavaScript Proxy.
- Flexible and Lightweight: Minimal setup required, suitable for various web applications.
Installation
Install vault-storage
using npm:
npm install vault-storage --save
Or using yarn:
yarn add vault-storage
Usage
First, import vault-storage
in your project:
import vault from 'vault-storage';
Initializing
Before performing any operations, initialize vault-storage
:
await vault.init();
Setting Values
Store data using the set
method:
await vault.set('yourKey', { any: 'data' });
Getting Values
Retrieve data using the get
method:
const data = await vault.get('yourKey');
console.log(data);
Removing Values
Remove data using the remove
method:
await vault.remove('yourKey');
Clearing All Data
Clear all data from the store:
await vault.clear();
Getting Store Length
Get the count of entries in the store:
const count = await vault.length();
console.log(count);
API Reference
init(database?: IDBDatabase, store?: string)
: Initialize the database. Optional custom database and store name can be provided.set(key: string, value: any)
: Store data in the database.get(key: string)
: Retrieve data from the database.remove(key: string)
: Remove data from the database.clear()
: Clear all data from the database.length()
: Get the count of entries in the database.
Contributing
Contributions to vault-storage
are welcome. Please ensure that your code adheres to the existing style and includes tests covering new features or bug fixes.
License
vault-storage
is MIT licensed.
Notes:
- Adjust and expand the sections as necessary to fit the specifics of
vault-storage
. - If you have additional configuration options, advanced usage, or a more complex API, include those details in the README.
- Consider adding a
LICENSE
file to your repository if not already present. - Include information about testing, contribution guidelines, and any other relevant documentation links if available.
- Personalize the introduction and description to reflect the unique features and benefits of
vault-storage
.