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