corestore 6.17.0 → 6.18.1
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 +10 -2
- package/index.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,11 +24,18 @@ const core2 = store.get({ name: 'core-2' })
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### API
|
|
27
|
-
#### `const store = new Corestore(storage)`
|
|
27
|
+
#### `const store = new Corestore(storage, opts = {})`
|
|
28
28
|
Create a new Corestore instance.
|
|
29
29
|
|
|
30
30
|
`storage` can be either a random-access-storage module, a string, or a function that takes a path and returns an random-access-storage instance.
|
|
31
31
|
|
|
32
|
+
Opts include:
|
|
33
|
+
```js
|
|
34
|
+
{
|
|
35
|
+
inflightRange: null // Advanced option. Forwarded to the Hypercores created by corestore.get(...)
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
32
39
|
#### `const core = store.get(key | { name: 'a-name', exclusive, ...hypercoreOpts})`
|
|
33
40
|
Loads a Hypercore, either by name (if the `name` option is provided), or from the provided key (if the first argument is a Buffer or String with hex/z32 key, or if the `key` options is set).
|
|
34
41
|
|
|
@@ -81,7 +88,8 @@ Useful when an application wants to accept an optional Corestore, but needs to m
|
|
|
81
88
|
{
|
|
82
89
|
primaryKey, // Overrides the primaryKey for this session
|
|
83
90
|
namespace, // If set to null it will reset to the DEFAULT_NAMESPACE
|
|
84
|
-
detach: true // By disabling this, closing the session will also close the store that created the session
|
|
91
|
+
detach: true, // By disabling this, closing the session will also close the store that created the session
|
|
92
|
+
inflightRange: null // Advanced option. Forwarded to the Hypercores created by `session.get(...)
|
|
85
93
|
}
|
|
86
94
|
```
|
|
87
95
|
|
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
32
32
|
this.passive = !!opts.passive
|
|
33
33
|
this.manifestVersion = typeof opts.manifestVersion === 'number' ? opts.manifestVersion : (root ? root.manifestVersion : DEFAULT_MANIFEST)
|
|
34
34
|
this.compat = typeof opts.compat === 'boolean' ? opts.compat : (root ? root.compat : DEFAULT_COMPAT)
|
|
35
|
+
this.inflightRange = opts.inflightRange || null
|
|
35
36
|
|
|
36
37
|
this._keyStorage = null
|
|
37
38
|
this._bootstrap = opts._bootstrap || null
|
|
@@ -308,6 +309,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
308
309
|
const core = new Hypercore(p => this.storage(storageRoot + '/' + p), {
|
|
309
310
|
_preready: this._preready.bind(this),
|
|
310
311
|
notDownloadingLinger: this._notDownloadingLinger,
|
|
312
|
+
inflightRange: this.inflightRange,
|
|
311
313
|
autoClose: true,
|
|
312
314
|
active: false,
|
|
313
315
|
encryptionKey: opts.encryptionKey || null,
|
|
@@ -483,6 +485,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
483
485
|
writable: !this._readonly,
|
|
484
486
|
_attached: opts && opts.detach === false ? this : null,
|
|
485
487
|
_root: this._root,
|
|
488
|
+
inflightRange: this.inflightRange,
|
|
486
489
|
...opts
|
|
487
490
|
})
|
|
488
491
|
if (this === this._root) this._rootStoreSessions.add(session)
|