hypercore-storage 0.0.32 → 0.0.33

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 +7 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -487,11 +487,16 @@ class HypercoreStorage {
487
487
  return new MemoryOverlay(this)
488
488
  }
489
489
 
490
- snapshot () {
490
+ snapshot (sharedLength = -1) {
491
491
  assert(this.destroyed === false)
492
492
  const s = new HypercoreStorage(this.root, this.discoveryKey, this.corePointer, this.dataPointer, this.db.snapshot())
493
493
 
494
- for (const dep of this.dependencies) s.dependencies.push(dep)
494
+ for (const dep of this.dependencies) {
495
+ const length = sharedLength !== -1 && sharedLength < dep.length ? sharedLength : dep.length
496
+ s.dependencies.push({ data: dep.data, length })
497
+
498
+ if (length === sharedLength) break
499
+ }
495
500
 
496
501
  return s
497
502
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",