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.
Files changed (2) hide show
  1. package/index.js +8 -0
  2. 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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rocksdb-native",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "librocksdb bindings for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",