Socket
Socket
Sign inDemoInstall

dexie

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dexie

A Minimalistic Wrapper for IndexedDB


Version published
Weekly downloads
458K
increased by0.23%
Maintainers
2
Weekly downloads
 
Created

What is dexie?

Dexie is a wrapper for IndexedDB, a low-level API for client-side storage of significant amounts of structured data, including files/blobs. Dexie simplifies the use of IndexedDB by providing a more developer-friendly API and additional features such as versioning, transactions, and observability.

What are dexie's main functionalities?

Database Initialization

This code initializes a new Dexie database named 'MyDatabase' and defines a schema for a 'friends' table with auto-incrementing primary key 'id' and indexed fields 'name' and 'age'.

const db = new Dexie('MyDatabase');
db.version(1).stores({
  friends: '++id,name,age'
});

Adding Data

This code adds a new record to the 'friends' table with the name 'John' and age 25.

db.friends.add({name: 'John', age: 25});

Querying Data

This code queries the 'friends' table for all records where the age is below 30 and logs the results to the console.

db.friends.where('age').below(30).toArray().then(friends => {
  console.log(friends);
});

Updating Data

This code updates the record with primary key 1 in the 'friends' table, setting the age to 26.

db.friends.update(1, {age: 26});

Deleting Data

This code deletes the record with primary key 1 from the 'friends' table.

db.friends.delete(1);

Other packages similar to dexie

Keywords

FAQs

Package last updated on 10 Jul 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