# @walletconnect/keyvaluestorage

> Isomorphic Key-Value Storage

Latest version **1.1.1** (published 2023-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @walletconnect/keyvaluestorage
pnpm add @walletconnect/keyvaluestorage
yarn add @walletconnect/keyvaluestorage
bun add @walletconnect/keyvaluestorage
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-11-15 |
| First published | 2022-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 82.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 132 |
| Author | WalletConnect, Inc. |
| Maintainers | nachosan, boidushya, huxwell, chris13524, crypblizz, devceline, gancho_walletconnect, iljadoesdev, bkrem, pedrouid |
| Keywords | iso, isomorphic, store, storage, localstorage, asyncstorage, sequelize |

## Links

- npm: https://www.npmjs.com/package/@walletconnect/keyvaluestorage
- Repository: https://github.com/walletconnect/walletconnect-utils
- Issues: https://github.com/walletconnect/walletconnect-utils/issues
- npm.io page: https://npm.io/package/@walletconnect/keyvaluestorage

## Dependencies (3)

- [unstorage](https://npm.io/package/unstorage.md) ^1.9.0
- [idb-keyval](https://npm.io/package/idb-keyval.md) ^6.2.1
- [@walletconnect/safe-json](https://npm.io/package/@walletconnect/safe-json.md) ^1.0.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2023-11-15
- 1.1.0-canary-3 (canary) — 2023-11-15
- 1.0.1-rc.2 (rc) — 2022-09-23
- 1.1.0-canary-2 — 2023-11-15
- 1.1.0-canary-1 — 2023-11-15
- 1.1.0 — 2023-11-10
- 1.0.2-canary.fd2778a — 2023-10-12
- 1.0.2-canary.758d7ff — 2023-10-12
- 1.0.2-canary.1 — 2023-10-11
- 1.0.2-canary.0 — 2023-10-11
- 1.0.2-canary-e580314 — 2023-06-01
- 1.0.2 — 2022-11-25
- 1.0.1-rc.1-1c715f7f — 2022-09-23
- 1.0.1-rc.1 — 2022-09-21
- 1.0.0-64a80ca5 — 2022-09-14
- … 5 more at https://npm.io/package/@walletconnect/keyvaluestorage/versions

## README

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

Isomorphic Key-Value Storage

## Example

```typescript
import KeyValueStorage from "keyvaluestorage";

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')
  tableName: 'keyvaluestorage'
}

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/@walletconnect/keyvaluestorage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
