boxo icon indicating copy to clipboard operation
boxo copied to clipboard

examples: verified file fetch

Open hacdias opened this issue 1 year ago • 1 comments

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.

hacdias avatar Feb 12 '24 14:02 hacdias

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.

Impacted file tree graph

@@            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%> (ø)

... and 196 files with indirect coverage changes

codecov[bot] avatar Mar 08 '24 12:03 codecov[bot]

@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.

hacdias avatar May 23 '24 07:05 hacdias