rocksdb-native 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -105,6 +105,14 @@ const RocksDB = module.exports = class RocksDB extends ReadyResource {
|
|
|
105
105
|
return new Iterator(this, opts)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
async peek (opts) {
|
|
109
|
+
for await (const value of this.iterator({ ...opts, limit: 1 })) { // eslint-disable-line no-unreachable-loop
|
|
110
|
+
return value
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
|
|
108
116
|
read (opts) {
|
|
109
117
|
return new ReadBatch(this, opts)
|
|
110
118
|
}
|