# pixel-idb

> Pixel is a library for using indexedDb in the background of a Google Chrome extension and in other scenarios it is also possible to use it.

Latest version **1.1.0** (published 2023-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install pixel-idb
pnpm add pixel-idb
yarn add pixel-idb
bun add pixel-idb
```

## 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.1.0 |
| Published | 2023-01-25 |
| First published | 2023-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | pas2000 |
| Maintainers | pas2000 |
| Keywords | indexedDb, extension, brasil, indexedDb for chrome extension, idb, chrome extension, promise |

## Links

- npm: https://www.npmjs.com/package/pixel-idb
- Repository: https://github.com/PAS20000/pixel
- Homepage: https://github.com/PAS20000/pixel#readme
- Issues: https://github.com/PAS20000/pixel/issues
- npm.io page: https://npm.io/package/pixel-idb

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-01-25
- 1.0.28 — 2023-01-25
- 1.0.27 — 2023-01-25
- 1.0.26 — 2023-01-25
- 1.0.25 — 2023-01-19
- 1.0.24 — 2023-01-19
- 1.0.23 — 2023-01-19
- 1.0.22 — 2023-01-19
- 1.0.2-1.1 — 2023-01-19
- 1.0.21 — 2023-01-19
- 1.0.2 — 2023-01-19
- 1.0.1 — 2023-01-19
- 1.0.0 — 2023-01-19

## README

# Pixel

Pixel is a library for using indexedDb in the background of a Google Chrome extension and in other scenarios it is also possible to use it.

## Installation

Use the package manager npm to install Pixel.

```bash
npm i pixel-idb
```

## Usage

```javascript
import Pixel from 'pixel-idb'
// create client
const client = new Pixel({
        dbName : 'User_DB',
        storeName : 'users',
        version : 1,
        table : [
          '@id', // @ = unique value
          'name',
          'email',
          'age'
        ]
})

// connect client and create store
const store = async () => await client.connect()

// this idbStore supports the same functions as indexedDb
const idbStore = async () => await store().idbStore()

// add will create a new record, if there is a field with a duplicate unique value the transaction will give an error
const add = async ({ id, name, email, age }) => await store().add({ id, name, email, age })

// put will create a new record, if there is a field with a duplicate unique value it will update the item.
const put = async ({ id, name, email, age }) => await store().put({ id, name, email, age })

// bulkDelete
const bulkDelete = async (arrayId) => await store().bulkDelete(arrayId)

// readAll
const readAll = async () => await store().read().all()

// deleteAll will clean the database
const deleteAll = async () => await store().deleteAll()
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)

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