Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,15 @@ class Hypercore extends EventEmitter {
return this._decode(encoding, block, index)
}

// TODO: use a single rocks batch when possible etc
async getBatch (indexes, opts) {
const promises = []
for (const index of indexes) {
promises.push(this.get(index, opts))
}
return Promise.all(promises)
}

async clear (start, end = start + 1, opts) {
if (this.opened === false) await this.opening
if (this.closing !== null) throw SESSION_CLOSED('cannot clear on a closed session', this.discoveryKey)
Expand Down
Loading