Skip to content

Commit 9ba57e6

Browse files
committed
support snapshotting
1 parent 75a3035 commit 9ba57e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const Monitor = require('./lib/monitor')
66

77
const DEFAULT_BLOCK_SIZE = 2 ** 16
88

9-
module.exports = class Hyperblobs {
9+
class Hyperblobs {
1010
constructor (core, opts = {}) {
1111
this.core = core
1212
this.blockSize = opts.blockSize || DEFAULT_BLOCK_SIZE
@@ -36,6 +36,10 @@ module.exports = class Hyperblobs {
3636
return this.core.close()
3737
}
3838

39+
snapshot () {
40+
return new Hyperblobs(this.core.snapshot())
41+
}
42+
3943
async put (blob, opts) {
4044
if (!b4a.isBuffer(blob)) blob = b4a.from(blob)
4145
const blockSize = (opts && opts.blockSize) || this.blockSize
@@ -120,3 +124,5 @@ module.exports = class Hyperblobs {
120124
this.core.off('download', this._boundOnDownload)
121125
}
122126
}
127+
128+
module.exports = Hyperblobs

0 commit comments

Comments
 (0)