Skip to content

Commit

Permalink
refactor: rename to car-file-fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed May 22, 2024
1 parent 5dd05ed commit 6c759ea
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 27 deletions.
2 changes: 2 additions & 0 deletions examples/car-file-fetcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
car-file-fetcher
hello.txt
34 changes: 34 additions & 0 deletions examples/car-file-fetcher/README.md
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.
27 changes: 0 additions & 27 deletions examples/verified-fetch/README.md

This file was deleted.

0 comments on commit 6c759ea

Please sign in to comment.