level-concat-iterator
Concatenate items from an iterator into an array.
Last updated 6 years ago by vweevers .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install level-concat-iterator 
SYNC missed versions from official npm registry.

level-concat-iterator

Concatenate entries from an iterator into an array.

level badge npm Node version Test Coverage Standard Common Changelog Donate

Usage

const concat = require('level-concat-iterator')
const level = require('level')

const db = level('./db')

db.put('foo', 'bar', function (err) {
  if (err) throw err

  concat(db.iterator(), function (err, entries) {
    if (err) throw err

    // [{ key: 'foo', value: 'bar' }]
    console.log(entries)
  })
})

With promises:

await db.put('foo', 'bar')
const entries = await concat(db.iterator())

If you are upgrading: please see UPGRADING.md.

API

concat(iterator[, callback])

Takes an abstract-leveldown compatible iterator as first parameter and calls the callback with an array of entries, where each entry is an object in the form { key, value }. Calls the callback with an error if iterator.next() or iterator.end() errors. If no callback is provided, a promise is returned.

Contributing

Level/concat-iterator is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the Contribution Guide for more details.

Donate

Support us with a monthly donation on Open Collective and help us continue our work.

License

MIT

Current Tags

  • 3.1.0                                ...           latest (3 years ago)

5 Versions

  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 0
Dependencies (0)
None
Dev Dependencies (7)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |