@le-space/orbitdb-storage-bridge 0.25.0 → 0.25.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/lib/gateway-fetch.js +15 -15
- package/package.json +1 -1
package/lib/gateway-fetch.js
CHANGED
|
@@ -116,21 +116,6 @@ const backoffFor = (response, attempt) => {
|
|
|
116
116
|
return 2000 * (attempt + 1);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
* Fetch the bytes behind a CID, trying each gateway in turn.
|
|
121
|
-
*
|
|
122
|
-
* @param {string} cid
|
|
123
|
-
* @param {Object} [options]
|
|
124
|
-
* @param {string[]} [options.gateways]
|
|
125
|
-
* @param {number} [options.timeout] per request, in ms
|
|
126
|
-
* @param {AbortSignal} [options.signal]
|
|
127
|
-
* @param {string} [options.accept] sent as `Accept`; `RAW_BLOCK` for a single
|
|
128
|
-
* block from a trustless gateway
|
|
129
|
-
* @param {number} [options.maxBackoff] longest 429 wait to honour, in ms
|
|
130
|
-
* @param {(ms: number) => Promise<void>} [options.sleep] injectable for tests
|
|
131
|
-
* @param {typeof fetch} [options.fetchImpl] injectable for tests
|
|
132
|
-
* @returns {Promise<Uint8Array>}
|
|
133
|
-
*/
|
|
134
119
|
/**
|
|
135
120
|
* True unless the CID is a raw sha-256 block whose digest the bytes miss.
|
|
136
121
|
* Anything this cannot check (another codec, another hash, an unparsable
|
|
@@ -157,6 +142,21 @@ export async function matchesRawCid(cid, bytes) {
|
|
|
157
142
|
return true;
|
|
158
143
|
}
|
|
159
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Fetch the bytes behind a CID, trying each gateway in turn.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} cid
|
|
149
|
+
* @param {Object} [options]
|
|
150
|
+
* @param {string[]} [options.gateways]
|
|
151
|
+
* @param {number} [options.timeout] per request, in ms
|
|
152
|
+
* @param {AbortSignal} [options.signal]
|
|
153
|
+
* @param {string} [options.accept] sent as `Accept`; `RAW_BLOCK` for a single
|
|
154
|
+
* block from a trustless gateway
|
|
155
|
+
* @param {number} [options.maxBackoff] longest 429 wait to honour, in ms
|
|
156
|
+
* @param {(ms: number) => Promise<void>} [options.sleep] injectable for tests
|
|
157
|
+
* @param {typeof fetch} [options.fetchImpl] injectable for tests
|
|
158
|
+
* @returns {Promise<Uint8Array>}
|
|
159
|
+
*/
|
|
160
160
|
export async function fetchFromGateways(
|
|
161
161
|
cid,
|
|
162
162
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/orbitdb-storage-bridge",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "Back up, restore and replicate OrbitDB databases through pluggable storage backends, with hash and identity preservation",
|
|
5
5
|
"main": "lib/orbitdb-storacha-bridge.js",
|
|
6
6
|
"svelte": "dist/components/",
|