master
md 72 lines 2.17 KB
Rendered Raw
1 # Dataset Description / Sources
2
3 TestGatewayHAMTDirectory.car generated with:
4
5 ```bash
6 ipfs version
7 # ipfs version 0.19.0
8
9 export HAMT_DIR=bafybeiggvykl7skb2ndlmacg2k5modvudocffxjesexlod2pfvg5yhwrqm
10 export IPFS_PATH=$(mktemp -d)
11
12 # Init and start daemon, ensure we have an empty repository.
13 ipfs init --empty-repo
14 ipfs daemon &> /dev/null &
15 export IPFS_PID=$!
16
17 # Retrieve the directory listing, forcing the daemon to download all required DAGs. Kill daemon.
18 curl -o dir.html http://127.0.0.1:8080/ipfs/$HAMT_DIR/
19 kill $IPFS_PID
20
21 # Get the list with all the downloaded refs and sanity check.
22 ipfs refs local > required_refs
23 cat required_refs | wc -l
24 # 962
25
26 # Get the list of all the files CIDs inside the directory and sanity check.
27 cat dir.html| pup '#content tbody .ipfs-hash attr{href}' | sed 's/\/ipfs\///g;s/\?filename=.*//g' > files_refs
28 cat files_refs | wc -l
29 # 10100
30
31 # Make and export our fixture.
32 ipfs files mkdir --cid-version 1 /fixtures
33 cat required_refs | xargs -I {} ipfs files cp /ipfs/{} /fixtures/{}
34 cat files_refs | ipfs files write --create /fixtures/files_refs
35 export FIXTURE_CID=$(ipfs files stat --hash /fixtures/)
36 echo $FIXTURE_CID
37 # bafybeig3yoibxe56aolixqa4zk55gp5sug3qgaztkakpndzk2b2ynobd4i
38 ipfs dag export $FIXTURE_CID > TestGatewayHAMTDirectory.car
39 ```
40
41 TestGatewayMultiRange.car generated with:
42
43
44 ```sh
45 ipfs version
46 # ipfs version 0.19.0
47
48 export FILE_CID=bafybeiae5abzv6j3ucqbzlpnx3pcqbr2otbnpot7d2k5pckmpymin4guau
49 export IPFS_PATH=$(mktemp -d)
50
51 # Init and start daemon, ensure we have an empty repository.
52 ipfs init --empty-repo
53 ipfs daemon &> /dev/null &
54 export IPFS_PID=$!
55
56 # Get a specific byte range from the file.
57 curl http://127.0.0.1:8080/ipfs/$FILE_CID -i -H "Range: bytes=1276-1279, 29839070-29839080"
58 kill $IPFS_PID
59
60 # Get the list with all the downloaded refs and sanity check.
61 ipfs refs local > required_refs
62 cat required_refs | wc -l
63 # 19
64
65 # Make and export our fixture.
66 ipfs files mkdir --cid-version 1 /fixtures
67 cat required_refs | xargs -I {} ipfs files cp /ipfs/{} /fixtures/{}
68 export FIXTURE_CID=$(ipfs files stat --hash /fixtures/)
69 echo $FIXTURE_CID
70 # bafybeicgsg3lwyn3yl75lw7sn4zhyj5dxtb7wfxwscpq6yzippetmr2w3y
71 ipfs dag export $FIXTURE_CID > TestGatewayMultiRange.car
72 ```