Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

idb-keyval

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb-keyval

A super-simple-small keyval store built on top of IndexedDB

  • 6.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
increased by6%
Maintainers
1
Weekly downloads
 
Created

What is idb-keyval?

The idb-keyval npm package is a simple key-value store backed by IndexedDB. It provides a straightforward API for storing, retrieving, and managing data in the browser's IndexedDB, making it easier to work with compared to the native IndexedDB API.

What are idb-keyval's main functionalities?

Set a value

This feature allows you to store a value in the IndexedDB with a specified key. The code sample demonstrates how to set a value 'value' with the key 'key'.

import { set } from 'idb-keyval';

set('key', 'value').then(() => console.log('Value set!'));

Get a value

This feature allows you to retrieve a value from the IndexedDB using a specified key. The code sample demonstrates how to get the value associated with the key 'key'.

import { get } from 'idb-keyval';

get('key').then(val => console.log('Value:', val));

Delete a value

This feature allows you to delete a value from the IndexedDB using a specified key. The code sample demonstrates how to delete the value associated with the key 'key'.

import { del } from 'idb-keyval';

del('key').then(() => console.log('Value deleted!'));

Clear all values

This feature allows you to clear all values from the IndexedDB. The code sample demonstrates how to clear all stored values.

import { clear } from 'idb-keyval';

clear().then(() => console.log('All values cleared!'));

Get all keys

This feature allows you to retrieve all keys from the IndexedDB. The code sample demonstrates how to get all keys stored in the database.

import { keys } from 'idb-keyval';

keys().then(keys => console.log('Keys:', keys));

Other packages similar to idb-keyval

Keywords

FAQs

Package last updated on 06 May 2023

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