hypercore 10.0.0-alpha.16 → 10.0.0-alpha.17
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/README.md +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ Options include
|
|
|
87
87
|
|
|
88
88
|
``` js
|
|
89
89
|
{
|
|
90
|
-
wait: true, // wait for
|
|
90
|
+
wait: true, // wait for block to be downloaded
|
|
91
91
|
onwait: () => {}, // hook that is called if the get is waiting for download
|
|
92
92
|
timeout: 0, // wait at max some milliseconds (0 means no timeout)
|
|
93
93
|
valueEncoding: 'json' | 'utf-8' | 'binary' // defaults to the core's valueEncoding
|
package/index.js
CHANGED
|
@@ -416,6 +416,7 @@ module.exports = class Hypercore extends EventEmitter {
|
|
|
416
416
|
if (this.core.bitfield.get(index)) {
|
|
417
417
|
block = await this.core.blocks.get(index)
|
|
418
418
|
} else {
|
|
419
|
+
if (opts && opts.wait === false) return null
|
|
419
420
|
if (opts && opts.onwait) opts.onwait(index)
|
|
420
421
|
block = await this.replicator.requestBlock(index)
|
|
421
422
|
}
|