# Retrieving and verifying files The catalog holds no file content. To use a file, download it from the address in its pointer and check it against the size and hashes the pointer gives. The fields are described in [fields.md](fields.md). ## Steps 1. Choose an address: `uri`, or one from `alt_uris`, which serve the same bytes. `s3://` addresses usually have a public https address in `alt_uris`. `hf://datasets/@/` stands for `https://huggingface.co/datasets//resolve//`. 2. If `access.needs_auth` says that a login, a guestbook or a form is needed, follow the source's procedure first. 3. If the pointer has `range`, request only those bytes with the HTTP header `Range: bytes=-`. The file is that byte range of `uri`, for example one record inside a WARC file, and `size_bytes` equals `length`. 4. Compare the number of bytes with `size_bytes`, unless it is `null` (the source does not publish the size). 5. Compute the hashes named in `hashes` and compare every value; `hash_scope` says what they cover (below). Treat a mismatch as a failure; do not substitute another file. 6. If `hashes` is empty (`hash_source` is `computed_on_fetch`), the source publishes no hash: compute your own after download and keep it with the file. ## What the hashes cover (`hash_scope`) - `file` (the default when the field is absent): the bytes you downloaded, that is the whole file, or the byte range when the pointer has `range`. - `http_payload`: the range is one gzip-compressed WARC record. Decompress it, remove the WARC and HTTP headers, undo chunked transfer encoding, and hash the HTTP response body. `size_bytes` stays the compressed length of the record. - `api_body`: `uri` returns JSON from an API. Hash the UTF-8 bytes of the field named in `source_meta.api_body_field` (a dotted path in which numbers index lists; `items.0.body` when absent), not the whole response. ## Files inside archives A pointer with `parent_pointer_id` and `member_path` is a file inside an archive that has its own pointer: retrieve and verify the archive, then extract `member_path`. ## Source notes and the manifests themselves Each `collection.json` adds notes for its source under `fetch` and `notes`. Its `shards` list gives the `sha256` of every part file of the batch, so the downloaded manifests can be checked too.