/usr/lib/nodejs/leveldown/leveldown.js is in node-leveldown 1.0.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | const util = require('util')
, AbstractLevelDOWN = require('abstract-leveldown').AbstractLevelDOWN
, binding = require('bindings')('leveldown.node').leveldown
, ChainedBatch = require('./chained-batch')
, Iterator = require('./iterator')
function LevelDOWN (location) {
if (!(this instanceof LevelDOWN))
return new LevelDOWN(location)
AbstractLevelDOWN.call(this, location)
this.binding = binding(location)
}
util.inherits(LevelDOWN, AbstractLevelDOWN)
LevelDOWN.prototype._open = function (options, callback) {
this.binding.open(options, callback)
}
LevelDOWN.prototype._close = function (callback) {
this.binding.close(callback)
}
LevelDOWN.prototype._put = function (key, value, options, callback) {
this.binding.put(key, value, options, callback)
}
LevelDOWN.prototype._get = function (key, options, callback) {
this.binding.get(key, options, callback)
}
LevelDOWN.prototype._del = function (key, options, callback) {
this.binding.del(key, options, callback)
}
LevelDOWN.prototype._chainedBatch = function () {
return new ChainedBatch(this)
}
LevelDOWN.prototype._batch = function (operations, options, callback) {
return this.binding.batch(operations, options, callback)
}
LevelDOWN.prototype._approximateSize = function (start, end, callback) {
this.binding.approximateSize(start, end, callback)
}
LevelDOWN.prototype.getProperty = function (property) {
if (typeof property != 'string')
throw new Error('getProperty() requires a valid `property` argument')
return this.binding.getProperty(property)
}
LevelDOWN.prototype._iterator = function (options) {
return new Iterator(this, options)
}
LevelDOWN.destroy = function (location, callback) {
if (arguments.length < 2)
throw new Error('destroy() requires `location` and `callback` arguments')
if (typeof location != 'string')
throw new Error('destroy() requires a location string argument')
if (typeof callback != 'function')
throw new Error('destroy() requires a callback function argument')
binding.destroy(location, callback)
}
LevelDOWN.repair = function (location, callback) {
if (arguments.length < 2)
throw new Error('repair() requires `location` and `callback` arguments')
if (typeof location != 'string')
throw new Error('repair() requires a location string argument')
if (typeof callback != 'function')
throw new Error('repair() requires a callback function argument')
binding.repair(location, callback)
}
module.exports = LevelDOWN
|