hypercore 10.5.2 → 10.5.4
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 +6 -4
- package/lib/bitfield.js +1 -0
- package/lib/core.js +0 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Hypercore
|
|
2
2
|
|
|
3
|
+
### [See the full API docs at docs.holepunch.to](https://docs.holepunch.to/building-blocks/hypercore)
|
|
4
|
+
|
|
3
5
|
Hypercore is a secure, distributed append-only log.
|
|
4
6
|
|
|
5
7
|
Built for sharing large datasets and streams of real time data
|
|
@@ -76,7 +78,7 @@ Note that `tree`, `data`, and `bitfield` are normally heavily sparse files.
|
|
|
76
78
|
|
|
77
79
|
You can also set valueEncoding to any [abstract-encoding](https://github.com/mafintosh/abstract-encoding) or [compact-encoding](https://github.com/compact-encoding) instance.
|
|
78
80
|
|
|
79
|
-
valueEncodings will be applied to
|
|
81
|
+
valueEncodings will be applied to individual blocks, even if you append batches. If you want to control encoding at the batch-level, you can use the `encodeBatch` option, which is a function that takes a batch and returns a binary-encoded batch. If you provide a custom valueEncoding, it will not be applied prior to `encodeBatch`.
|
|
80
82
|
|
|
81
83
|
#### `const { length, byteLength } = await core.append(block)`
|
|
82
84
|
|
|
@@ -124,7 +126,7 @@ Check if the core has all blocks between `start` and `end`.
|
|
|
124
126
|
|
|
125
127
|
#### `const updated = await core.update()`
|
|
126
128
|
|
|
127
|
-
Wait for the core to try and find a signed update to
|
|
129
|
+
Wait for the core to try and find a signed update to its length.
|
|
128
130
|
Does not download any data from peers except for a proof of the new core length.
|
|
129
131
|
|
|
130
132
|
``` js
|
|
@@ -137,7 +139,7 @@ console.log('core was updated?', updated, 'length is', core.length)
|
|
|
137
139
|
|
|
138
140
|
Seek to a byte offset.
|
|
139
141
|
|
|
140
|
-
Returns `[index, relativeOffset]`, where `index` is the data block the byteOffset is contained in and `relativeOffset` is
|
|
142
|
+
Returns `[index, relativeOffset]`, where `index` is the data block the `byteOffset` is contained in and `relativeOffset` is
|
|
141
143
|
the relative byte offset in the data block.
|
|
142
144
|
|
|
143
145
|
``` js
|
|
@@ -293,7 +295,7 @@ as all internals await this themself.
|
|
|
293
295
|
|
|
294
296
|
#### `core.on('ready')`
|
|
295
297
|
|
|
296
|
-
Emitted after the core has initially opened all
|
|
298
|
+
Emitted after the core has initially opened all its internal state.
|
|
297
299
|
|
|
298
300
|
#### `core.writable`
|
|
299
301
|
|
package/lib/bitfield.js
CHANGED
package/lib/core.js
CHANGED
|
@@ -262,12 +262,9 @@ module.exports = class Core {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
start = this.bitfield.lastSet(start) + 1
|
|
265
|
-
/* TODO: this borks for some reason, so needs a fix.
|
|
266
265
|
end = this.bitfield.firstSet(end)
|
|
267
266
|
|
|
268
267
|
if (end === -1) end = this.tree.length
|
|
269
|
-
*/
|
|
270
|
-
while (end < this.tree.length && this.bitfield.get(end) === false) end++
|
|
271
268
|
|
|
272
269
|
const offset = await this.tree.byteOffset(start * 2)
|
|
273
270
|
const [byteEnd, byteEndLength] = await this.tree.byteRange((end - 1) * 2)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypercore",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.4",
|
|
4
4
|
"description": "Hypercore is a secure, distributed append-only log",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/
|
|
12
|
+
"url": "git+https://github.com/holepunchto/hypercore.git"
|
|
13
13
|
},
|
|
14
14
|
"contributors": [
|
|
15
15
|
{
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"bugs": {
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/holepunchto/hypercore/issues"
|
|
29
29
|
},
|
|
30
|
-
"homepage": "https://github.com/
|
|
30
|
+
"homepage": "https://github.com/holepunchto/hypercore#readme",
|
|
31
31
|
"files": [
|
|
32
32
|
"index.js",
|
|
33
33
|
"lib/**.js"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"random-access-file": "^4.0.0",
|
|
48
48
|
"random-array-iterator": "^1.0.0",
|
|
49
49
|
"safety-catch": "^1.0.1",
|
|
50
|
-
"sodium-universal": "^
|
|
50
|
+
"sodium-universal": "^4.0.0",
|
|
51
51
|
"streamx": "^2.12.4",
|
|
52
52
|
"xache": "^1.1.0",
|
|
53
53
|
"z32": "^1.0.0"
|