@helia/verified-fetch 2.6.14 → 2.6.16
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 +7 -7
- package/dist/index.min.js +56 -56
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +12 -12
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugins/plugin-handle-car.d.ts.map +1 -1
- package/dist/src/plugins/plugin-handle-car.js +5 -1
- package/dist/src/plugins/plugin-handle-car.js.map +1 -1
- package/dist/src/plugins/plugin-handle-raw.js +2 -2
- package/dist/src/plugins/plugin-handle-raw.js.map +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.d.ts +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.d.ts.map +1 -1
- package/dist/src/utils/get-stream-from-async-iterable.js.map +1 -1
- package/dist/src/utils/get-tar-stream.d.ts.map +1 -1
- package/dist/src/utils/get-tar-stream.js.map +1 -1
- package/dist/src/utils/handle-redirects.d.ts +2 -2
- package/dist/src/utils/handle-redirects.d.ts.map +1 -1
- package/dist/src/utils/handle-redirects.js +3 -5
- package/dist/src/utils/handle-redirects.js.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.browser.js.map +1 -1
- package/dist/src/utils/libp2p-defaults.d.ts.map +1 -1
- package/dist/src/utils/libp2p-defaults.js.map +1 -1
- package/dist/src/utils/parse-url-string.d.ts +1 -1
- package/dist/src/utils/parse-url-string.d.ts.map +1 -1
- package/dist/src/utils/parse-url-string.js +2 -2
- package/dist/src/utils/parse-url-string.js.map +1 -1
- package/dist/src/utils/set-content-type.d.ts +2 -2
- package/dist/src/utils/set-content-type.d.ts.map +1 -1
- package/dist/src/utils/set-content-type.js +0 -2
- package/dist/src/utils/set-content-type.js.map +1 -1
- package/dist/src/utils/walk-path.d.ts +3 -3
- package/dist/src/utils/walk-path.d.ts.map +1 -1
- package/dist/src/utils/walk-path.js +0 -2
- package/dist/src/utils/walk-path.js.map +1 -1
- package/dist/src/verified-fetch.d.ts +1 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +0 -3
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +54 -30
- package/src/index.ts +14 -12
- package/src/plugins/plugin-handle-car.ts +5 -1
- package/src/plugins/plugin-handle-raw.ts +2 -2
- package/src/utils/get-stream-from-async-iterable.ts +2 -1
- package/src/utils/get-tar-stream.ts +4 -2
- package/src/utils/handle-redirects.ts +5 -5
- package/src/utils/libp2p-defaults.browser.ts +2 -1
- package/src/utils/libp2p-defaults.ts +2 -1
- package/src/utils/parse-url-string.ts +4 -3
- package/src/utils/set-content-type.ts +2 -2
- package/src/utils/walk-path.ts +4 -3
- package/src/verified-fetch.ts +5 -4
- package/LICENSE +0 -4
package/README.md
CHANGED
|
@@ -399,7 +399,7 @@ console.info(obj.buf) // Uint8Array(5) [ 0, 1, 2, 3, 4 ]
|
|
|
399
399
|
|
|
400
400
|
[DAG-CBOR](https://ipld.io/docs/codecs/known/dag-cbor/) uses the [Concise Binary Object Representation](https://cbor.io/) format for serialization instead of JSON.
|
|
401
401
|
|
|
402
|
-
This supports more
|
|
402
|
+
This supports more data types in a safer way than JSON and is smaller on the wire to boot so is usually preferable to JSON or DAG-JSON.
|
|
403
403
|
|
|
404
404
|
##### Content-Type
|
|
405
405
|
|
|
@@ -479,7 +479,7 @@ const res = await verifiedFetch('ipfs://bafyfoo/path/to/dir')
|
|
|
479
479
|
console.info(res.url) // ipfs://bafyfoo/path/to/dir/
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
It's possible to prevent this
|
|
482
|
+
It's possible to prevent this behavior and/or handle a redirect manually
|
|
483
483
|
through use of the [redirect](https://developer.mozilla.org/en-US/docs/Web/API/fetch#redirect)
|
|
484
484
|
option.
|
|
485
485
|
|
|
@@ -658,7 +658,7 @@ Known Errors that can be thrown:
|
|
|
658
658
|
3. `TypeError` - If the options argument is passed and is malformed.
|
|
659
659
|
4. `AbortError` - If the content request is aborted due to user aborting provided AbortSignal. Note that this is a `AbortError` from `@libp2p/interface` and not the standard `AbortError` from the Fetch API.
|
|
660
660
|
|
|
661
|
-
##
|
|
661
|
+
## Extensibility
|
|
662
662
|
|
|
663
663
|
Verified‑fetch can now be extended to alter how it handles requests by using plugins.
|
|
664
664
|
Plugins are classes that extend the `BasePlugin` class and implement the `VerifiedFetchPlugin`
|
|
@@ -858,7 +858,7 @@ $ npm i @helia/verified-fetch
|
|
|
858
858
|
|
|
859
859
|
## Browser `<script>` tag
|
|
860
860
|
|
|
861
|
-
Loading this module through a script tag will make
|
|
861
|
+
Loading this module through a script tag will make its exports available as `HeliaVerifiedFetch` in the global namespace.
|
|
862
862
|
|
|
863
863
|
```html
|
|
864
864
|
<script src="https://unpkg.com/@helia/verified-fetch/dist/index.min.js"></script>
|
|
@@ -866,14 +866,14 @@ Loading this module through a script tag will make it's exports available as `He
|
|
|
866
866
|
|
|
867
867
|
# API Docs
|
|
868
868
|
|
|
869
|
-
- <https://ipfs.github.io/helia-verified-fetch/modules.html>
|
|
869
|
+
- <https://ipfs.github.io/helia-verified-fetch/modules/_helia_verified_fetch.html>
|
|
870
870
|
|
|
871
871
|
# License
|
|
872
872
|
|
|
873
873
|
Licensed under either of
|
|
874
874
|
|
|
875
|
-
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
876
|
-
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
875
|
+
- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/helia-verified-fetch/blob/main/packages/verified-fetch/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
876
|
+
- MIT ([LICENSE-MIT](https://github.com/ipfs/helia-verified-fetch/blob/main/packages/verified-fetch/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
877
877
|
|
|
878
878
|
# Contribute
|
|
879
879
|
|