corestore 6.17.0 → 6.18.0

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 (3) hide show
  1. package/README.md +10 -2
  2. package/index.js +5 -0
  3. 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
@@ -384,6 +385,9 @@ module.exports = class Corestore extends ReadyResource {
384
385
  if (this._readonly && opts.writable !== false) {
385
386
  opts.writable = false
386
387
  }
388
+ if (!opts.inflightRange && this.inflightRange) {
389
+ opts.inflightRange = this.inflightRange
390
+ }
387
391
 
388
392
  let rw = null
389
393
  let id = null
@@ -483,6 +487,7 @@ module.exports = class Corestore extends ReadyResource {
483
487
  writable: !this._readonly,
484
488
  _attached: opts && opts.detach === false ? this : null,
485
489
  _root: this._root,
490
+ inflightRange: this.inflightRange,
486
491
  ...opts
487
492
  })
488
493
  if (this === this._root) this._rootStoreSessions.add(session)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.17.0",
3
+ "version": "6.18.0",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {