New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vault-storage

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vault-storage

Vault, a tiny yet robuts storage library for your browser applications

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-70.59%
Maintainers
1
Weekly downloads
 
Created
Source

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:

// Initialize with default settings
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.

FAQs

Package last updated on 01 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc