examples: verified file fetch
This adds a simple example on how you can use Boxo to verifiably download a file from a trustless gateway. It does not cover the case where we have directories. I think having this, albeit not supporting directories, is better than nothing. With time, we should convert this into its own library module.
Based on #594 to reuse some code.
Codecov Report
Attention: Patch coverage is 36.53846% with 33 lines in your changes are missing coverage. Please review.
Project coverage is 60.11%. Comparing base (
09b0013) to head (d3384f3). Report is 1 commits behind head on main.
@@ Coverage Diff @@
## main #577 +/- ##
==========================================
- Coverage 60.52% 60.11% -0.42%
==========================================
Files 238 236 -2
Lines 29483 23543 -5940
==========================================
- Hits 17844 14152 -3692
+ Misses 10022 7755 -2267
- Partials 1617 1636 +19
| Files | Coverage Δ | |
|---|---|---|
| examples/car-file-fetcher/main.go | 36.53% <36.53%> (ø) |
@lidel @aschmahmann I'm mesmerised by how short this code snippet is, and it does more than what we had before. It is stupidly simple and works for both regular files and directories. We already had all the necessary pieces in Boxo. No need to be meddling with go-car for this example.