Created
March 6, 2015 22:22
-
-
Save mafintosh/203859171ed19a1b2e57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var atomicQueue = require(...) | |
var queue = atomicQueue(db, function (data, cb) { | |
console.log('got some work', data) | |
// do stuff ... | |
cb(null, result) // if no error this work will be removed from the leveldb | |
}) | |
// write will add this 'work' to the leveldb | |
queue.write({some: 'world'}) | |
// where there is a work 'result' it will be pushed to the readable stream | |
queue.on('data', function (data) { | |
console.log(data) // the work result | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment