async-iterator

A Standard API for LevelDOWN style Iterator.

npm install async-iterator
7 downloads in the last week
11 downloads in the last month

async-iterator

A Standard API for LevelDOWN style Iterator.

Stability

Unstable: Expect patches and features, possible api changes.

Example

var Iterator = require('async-iterator')

var it = Iterator(function get (i, cb) {
  //retrive the Ith item.
}, function end (cb) {
  //drop everthing! iterator is no longer needed!
})

API

Iterator#next(cb)

Get the next item.

Will error if:

  • you are already retriving an item, but the callback has not yet been called.
  • the Iterator has ended.

Iterator#end(cb)

Dispose of the Iterator. If you have called Iterator#next but it has not called back yet, then the end call will be queued until it has.

#

License

MIT

npm loves you