# fortune-indexeddb

> IndexedDB adapter for Fortune.

Latest version **1.2.2** (published 2024-02-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2024-02-21 |
| First published | 2016-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 27.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | daliwali, ctcpip |
| Keywords | indexeddb, adapter |

## Links

- npm: https://www.npmjs.com/package/fortune-indexeddb
- Repository: https://github.com/fortunejs/fortune-indexeddb
- Homepage: https://github.com/fortunejs/fortune-indexeddb#readme
- Issues: https://github.com/fortunejs/fortune-indexeddb/issues
- npm.io page: https://npm.io/package/fortune-indexeddb

## Dependencies (1)

- [msgpack-lite](https://npm.io/package/msgpack-lite.md) ^0.1.26

## Recent versions

- 1.2.2 (latest) — 2024-02-21
- 1.2.1 — 2021-06-17
- 1.2.0 — 2021-06-17
- 1.1.5 — 2021-06-11
- 1.1.4 — 2021-06-11
- 1.1.3 — 2021-06-05
- 1.1.2 — 2019-07-12
- 1.1.1 — 2019-06-06
- 1.1.0 — 2019-06-06
- 1.0.3 — 2018-06-29
- 1.0.2 — 2018-06-28
- 1.0.1 — 2017-01-10
- 1.0.0 — 2016-10-30

## README

# Fortune IndexedDB

[![Build Status](https://img.shields.io/travis/fortunejs/fortune-indexeddb/master.svg?style=flat-square)](https://travis-ci.org/fortunejs/fortune-indexeddb)
[![npm Version](https://img.shields.io/npm/v/fortune-indexeddb.svg?style=flat-square)](https://www.npmjs.com/package/fortune-indexeddb)
[![License](https://img.shields.io/npm/l/fortune-indexeddb.svg?style=flat-square)](https://raw.githubusercontent.com/fortunejs/fortune-indexeddb/master/LICENSE)

This is an IndexedDB adapter for Fortune.js. Various performance and compatibility optimizations are included:

- Runs in a Web Worker so that database operations don't [block the main thread](https://nolanlawson.com/2015/09/29/indexeddb-websql-localstorage-what-blocks-the-dom/), and uses [MessagePack](http://msgpack.org) for [messaging](https://developer.mozilla.org/en/docs/Web/API/Worker/postMessage).
- Lazy loads records as they're requested and keeps them in memory.
- Primary keys are universally unique, which solves some [compatibility problems](https://www.raymondcamden.com/2014/09/25/IndexedDB-on-iOS-8-Broken-Bad).

```sh
$ npm install fortune-indexeddb
```


## Usage

This module works in web browsers only, and falls back to memory if IndexedDB is not available:

```js
const fortune = require('fortune')
const indexedDBAdapter = require('fortune-indexeddb')

const store = fortune(recordTypes, {
  adapter: [ indexedDBAdapter, {
    // Name of the IndexedDB database to use. Defaults to `db`.
    name: 'db',
    // These are optional to implement, if storage compression is needed.
    compress: uint8array => uint8array,
    decompress: uint8array => uint8array,
  } ]
})
```


## License

This software is licensed under the [MIT license](https://raw.githubusercontent.com/fortunejs/fortune-indexeddb/master/LICENSE).

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