diff --git a/lib/levelup.js b/lib/levelup.js index 22b6721e..63939eb6 100644 --- a/lib/levelup.js +++ b/lib/levelup.js @@ -186,7 +186,7 @@ LevelUP.prototype.get = function (key_, options, callback) { options.asBuffer = util.isValueAsBuffer(options) - this.db.get(key, options, function (err, value) { + this.db.get(key, options, function (err, value, extra) { if (err) { if ((/notfound/i).test(err)) { err = new NotFoundError( @@ -202,7 +202,7 @@ LevelUP.prototype.get = function (key_, options, callback) { } catch (e) { return callback(new EncodingError(e)) } - callback(null, value) + callback(null, value, extra) } }) } @@ -235,13 +235,13 @@ LevelUP.prototype.put = function (key_, value_, options, callback) { key = util.encodeKey(key_, options) value = util.encodeValue(value_, options) - this.db.put(key, value, options, function (err) { + this.db.put(key, value, options, function (err, extra) { if (err) { return dispatchError(self, new WriteError(err), callback) } else { - self.emit('put', key_, value_) + self.emit('put', key_, value_, extra) if (callback) - callback() + callback(null, extra) } }) }