# keyvaluestorage-interface

> Isomorphic Key-Value Storage Interface

Latest version **1.0.0** (published 2021-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install keyvaluestorage-interface
pnpm add keyvaluestorage-interface
yarn add keyvaluestorage-interface
bun add keyvaluestorage-interface
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-02-02 |
| First published | 2021-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 111.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Pedro Gomes |
| Maintainers | pedrouid |
| Keywords | iso, isomorphic, store, storage, localstorage, asyncstorage, sequelize, sqlite, interface |

## Links

- npm: https://www.npmjs.com/package/keyvaluestorage-interface
- Repository: https://github.com/pedrouid/keyvaluestorage-interface
- Issues: https://github.com/pedrouid/keyvaluestorage-interface/issues
- npm.io page: https://npm.io/package/keyvaluestorage-interface

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-02-02

## README

# keyvaluestorage-interface [![npm version](https://badge.fury.io/js/keyvaluestorage-interface.svg)](https://badge.fury.io/js/keyvaluestorage-interface)

Isomorphic Key-Value Storage Interface

## Example

```typescript
import KeyValueStorage from "keyvaluestorage-interface";

const options = {
  // required for React-Native platform
  // package from @react-native-async-storage/async-storage
  asyncStorage: AsyncStorage
  // required for NodeJS platform
  // sqlite database connection (in-memory supported)
  database: 'foobar.db'
  // optional for NodeJS platform
  // sqlite table name (default: 'keyvaluestorage-interface')
  tableName: 'keyvaluestorage-interface'
}

const storage = new KeyValueStorage(options)

// setItem
await storage.setItem('user1', { name: 'John Doe', age: 21 })

// getItem
const item = await storage.getItem('user1')

// removeItem
await storage.removeItem('user1')
```

## API

```typescript
export class IKeyValueStorage {
  public getKeys(): Promise<string[]>;
  public getEntries<T = any>(): Promise<[string, T][]>;
  public getItem<T = any>(key: string): Promise<T | undefined>;
  public setItem<T = any>(key: string, value: T): Promise<void>;
  public removeItem(key: string): Promise<void>;
}
```

---
_Source: https://npm.io/package/keyvaluestorage-interface · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
