# indexeddb-wrapper

> Creates a key value wrapper around IndexedDB.

Latest version **0.1.2** (published 2020-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install indexeddb-wrapper
pnpm add indexeddb-wrapper
yarn add indexeddb-wrapper
bun add indexeddb-wrapper
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-02-28 |
| First published | 2020-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sem Postma |
| Maintainers | afirus |

## Links

- npm: https://www.npmjs.com/package/indexeddb-wrapper
- npm.io page: https://npm.io/package/indexeddb-wrapper

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15

## Recent versions

- 0.1.2 (latest) — 2020-02-28

## README

# indexeddb-wrapper

## Installation

```bash 
npm install --save indexeddb-wrapper
```

## Usage

```javascript
import indexeddbWrapper from 'indexeddb-wrapper'

const { myStore } = createIndexeDBWrapper({ stores: ['myStore'] }) 

store.set('key', 'value')
    .then(() => store.get('key'))
    .then(console.log)
```

## Warning

Use proper promise error handling to catch common errors like this:
```javascript
store.get('key').then(console.log).catch(error => {
  if (error.name === 'QuotaExceededError') {
    alert('Failed to save. Not enough storage.');
  }
  throw error;
})
```

## API

### Interface: IndexeDBWrapper

* [stores](#store)

#### stores

• **stores**: *object*

Defined in index.ts:12

### Interface: Store

* [destroy](#destroy)
* [get](#get)
* [keys](#keys)
* [purge](#purge)
* [remove](#remove)
* [set](#set)

####  destroy

• **destroy**: *function*

Defined in index.ts:8

##### Type declaration:

▸ (): *Promise‹void›*

___

####  get

• **get**: *function*

Defined in index.ts:3

##### Type declaration:

▸ (`key`: string): *Promise‹any›*

**Parameters:**

Name | Type |
------ | ------ |
`key` | string |

___

####  keys

• **keys**: *function*

Defined in index.ts:4

##### Type declaration:

▸ (): *Promise‹string[]›*

___

####  purge

• **purge**: *function*

Defined in index.ts:6

##### Type declaration:

▸ (): *Promise‹void›*

___

####  remove

• **remove**: *function*

Defined in index.ts:7

##### Type declaration:

▸ (`key`: string): *Promise‹void›*

**Parameters:**

Name | Type |
------ | ------ |
`key` | string |

___

####  set

• **set**: *function*

Defined in index.ts:5

##### Type declaration:

▸ (`key`: string, `value`: any): *Promise‹void›*

**Parameters:**

Name | Type |
------ | ------ |
`key` | string |
`value` | any |

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