hypercore 10.31.9 → 10.31.10

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.
package/lib/core.js CHANGED
@@ -230,6 +230,8 @@ module.exports = class Core {
230
230
  }
231
231
 
232
232
  try {
233
+ const updates = []
234
+
233
235
  let pos = 0
234
236
 
235
237
  while (pos < length) {
@@ -252,6 +254,12 @@ module.exports = class Core {
252
254
  this.bitfield.setRange(segmentStart, segmentEnd - segmentStart, true)
253
255
 
254
256
  pos = segmentEnd + 1
257
+
258
+ updates.push({
259
+ drop: false,
260
+ start: segmentStart,
261
+ length: segmentEnd - segmentStart
262
+ })
255
263
  }
256
264
 
257
265
  for (let i = 0; i < length * 2; i++) {
@@ -295,6 +303,10 @@ module.exports = class Core {
295
303
  this.header.userData = src.header.userData.slice(0)
296
304
  this.header.hints.contiguousLength = Math.min(src.header.hints.contiguousLength, this.header.tree.length)
297
305
 
306
+ for (const bitfield of updates) {
307
+ this.onupdate(0b0001, bitfield, null, null)
308
+ }
309
+
298
310
  await this._flushOplog()
299
311
  } finally {
300
312
  src._mutex.unlock()
package/lib/streams.js CHANGED
@@ -105,7 +105,7 @@ class ByteStream extends Readable {
105
105
  }
106
106
 
107
107
  this._predownload(this._index + 1)
108
- data = await this._core.get(this._index++)
108
+ data = await this._core.get(this._index++, { valueEncoding: 'binary' })
109
109
 
110
110
  if (relativeOffset > 0) data = data.subarray(relativeOffset)
111
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.31.9",
3
+ "version": "10.31.10",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {