# ingestdb-level

> Secondary indexes and utilities for leveldb.

Latest version **1.0.5** (published 2017-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install ingestdb-level
pnpm add ingestdb-level
yarn add ingestdb-level
bun add ingestdb-level
```

## 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.0.5 |
| Published | 2017-09-27 |
| First published | 2017-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Paul Frazee |
| Maintainers | pfraze |
| Keywords | level, levelup, secondary, indexes, index |

## Links

- npm: https://www.npmjs.com/package/ingestdb-level
- Repository: https://github.com/beakerbrowser/ingestdb-level
- Issues: https://github.com/beakerbrowser/ingestdb-level/issues
- npm.io page: https://npm.io/package/ingestdb-level

## Dependencies (4)

- [xtend](https://npm.io/package/xtend.md) ~4.0.1
- [await-lock](https://npm.io/package/await-lock.md) ^1.1.2
- [level-promise](https://npm.io/package/level-promise.md) ^2.1.1
- [readable-stream](https://npm.io/package/readable-stream.md) ~2.2.0

## Recent versions

- 1.0.5 (latest) — 2017-09-27

## README

# ingestdb-level

Secondary indexes and promisification for leveldb.

## Example

```js
const level = require('level')
const ingestdbLevel = require('ingestdb-level')
const sub = require('level-sublevel')

const db = ingestdbLevel(sub(level(__dirname + '/db', {
  valueEncoding: 'json'
})), ['lastName', 'lastName+firstName', '*attributes'])


const PAUL = {firstName: 'Paul', lastName: 'Frazee', attributes: ['ginger', 'hacker']}
const JACK = {firstName: 'Jack', lastName: 'Frazee', attributes: ['ginger', 'lawyer']}
const TARA = {firstName: 'Tara', lastName: 'Vancil', attributes: ['brunette', 'hacker']}

await db.put(1, PAUL)
await db.put(2, JACK)
await db.put(3, TARA)

await db.get(1) // => PAUL
await db.indexes.lastName.get('Vancil') // => TARA
await db.indexes['lastName+firstName'].get(['Frazee', 'Jack']) // => JACK
await db.indexes.attributes.get('hacker') // => PAUL
db.createValueStream() // => [PAUL, JACK, TARA]
db.indexes.lastName.createValueStream({gt: 'Frazee'}) // => [TARA]
db.indexes['lastName+firstName'].createValueStream({gte: ['Frazee']}) // => [JACK, PAUL, TARA]
db.indexes.attributes.createValueStream({gte: 'hacker', lte: 'hacker'}) // => [PAUL, TARA]

JACK.attributes.push('hacker')
await db.put(2, JACK)

db.indexes.attributes.createValueStream({gte: 'hacker', lte: 'hacker'}) // => [PAUL, TARA, JACK]
```

## API

```js
const ingestdbLevel = require('ingestdb-level')
const db = ingestdbLevel(level, indexesSpec)
await db.get(key, opts)
await db.put(key, value, opts)
await db.del(key, opts)
db.createReadStream(opts)
db.createKeyStream(opts)
db.createValueStream(opts)
await db.indexes[...].get(key, opts)
db.indexes[...].createReadStream(opts)
db.indexes[...].createKeyStream(opts)
db.indexes[...].createValueStream(opts)
```

## License

(MIT)

Copyright (c) 2017 Paul Frazee &lt;pfrazee@gmail.com&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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