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

@paper-db/kv-storage

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paper-db/kv-storage

LocalForage based key-value storage for Browser, Node.js (use datastore-level), and Cordova/Ionic (use localforage-cordovasqlitedriver)

  • 2.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@paper-db/kv-storage

LocalForage based key-value storage for Browser, Node.js, and Cordova/Ionic.

LocalForage Drivers

  • Browser:
    • IndexedDB
    • datastore-level
    • WebSQL
    • localStorage
  • Node.js:
  • Cordova/Ionic

Installation

npm install @paper-db/kv-storage

If you would like to use SQLite as a storage engine for Cordova/Ionic, install the SQLite plugin dependency:

cordova plugin add cordova-sqlite-storage --save

Usage

Example:

const { KVStorage } = require('@paper-db/kv-storage')

const storage = new KVStorage({
  path: './test-db',  // path to the level-datastore being used, only required when using datastore-level localForage driver
})

await storage.ready()

await storage.set('test', 123)

console.log(await storage.has('test'))  // true
console.log(await storage.get('test'))  // 123

console.log(await storage.length())  // 1
console.log(await storage.keys())  // ['test']

storage.forEach((value, key, i) => {
  console.log(value, key, i)  // 123 'test' 0
})

await storage.remove('test')

API

see dist/index.d.ts

License

MIT

FAQs

Package last updated on 14 Apr 2020

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