generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename to car-file-fetcher
avoid confusion with https://www.npmjs.com/package/@helia/verified-fetch
- Loading branch information
Showing
7 changed files
with
36 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
car-file-fetcher | ||
hello.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# CAR File Fetcher | ||
|
||
This example shows how to download a UnixFS file from a gateway that implements | ||
[application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) | ||
responses of the [Trustles Gateway](https://specs.ipfs.tech/http-gateways/trustless-gateway/) | ||
specification, in a trustless, verifiable manner. | ||
|
||
It relies on [IPIP-402](https://specs.ipfs.tech/ipips/ipip-0402/) to retrieve | ||
the file entity via a single CAR request with all blocks required for end-to-end | ||
verification. | ||
|
||
## Build | ||
|
||
```bash | ||
> go build -o fetcher | ||
``` | ||
|
||
## Usage | ||
|
||
First, you need a gateway that complies with the Trustless Gateway specification. | ||
In our specific case, we need that the gateway supports both the CAR file format. | ||
|
||
As an example, you can verifiably fetch a `hello.txt` file from IPFS gateway at `https://trustless-gateway.link`: | ||
|
||
``` | ||
./fetcher -g https://trustless-gateway.link -o hello.txt /ipfs/bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e | ||
``` | ||
|
||
## Additional learning | ||
|
||
For the sake of simplicity, this example does not support downloading UnixFS directories. | ||
|
||
See [`extract.go`](https://github.com/ipld/go-car/blob/master/cmd/car/extract.go) | ||
file from `go-car` in order to understand how to convert a directory into a file system. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.