Comparing version 2.14.2 to 2.15.0
17
index.js
@@ -296,3 +296,2 @@ const codecs = require('codecs') | ||
this._view = !!opts._view | ||
this._updated = false | ||
@@ -423,2 +422,7 @@ this._onappendBound = this._view ? null : this._onappend.bind(this) | ||
getBySeq (seq, opts) { | ||
const b = new Batch(this, this._makeSnapshot(), null, true, opts) | ||
return b.getBySeq(seq) | ||
} | ||
put (key, value, opts) { | ||
@@ -676,2 +680,13 @@ const b = new Batch(this, this.core, null, true, opts) | ||
async getBySeq (seq, opts) { | ||
const encoding = this._getEncoding(opts) | ||
try { | ||
const block = (await this.getBlock(seq)).final(encoding) | ||
return { key: block.key, value: block.value } | ||
} finally { | ||
await this._closeSnapshot() | ||
} | ||
} | ||
async get (key, opts) { | ||
@@ -678,0 +693,0 @@ const encoding = this._getEncoding(opts) |
{ | ||
"name": "hyperbee", | ||
"version": "2.14.2", | ||
"version": "2.15.0", | ||
"description": "An append-only B-tree running on a Hypercore.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -187,2 +187,8 @@ # Hyperbee 🐝 | ||
#### `const { key, value } = await db.getBySeq(seq, [options])` | ||
Get the key and value from a block number. | ||
`seq` is the Hypercore index. Returns `null` if block doesn't exists. | ||
#### `const stream = db.replicate(isInitiatorOrStream)` | ||
@@ -189,0 +195,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92064
2528
394