Skip to content

8. Compare

Gurdeep Singh (Guru) edited this page Jul 1, 2024 · 1 revision

Every time you execute the downloader with download command (without resume), it queries the API from hash 00000 - FFFFF for any update. If the hash file does not exists locally, it downloads the hash file. If the file exists, we send the Etag information we have in the request header. If the return response code is 200, it means the API Etag has been changed as the hash file has changed on the API server. If we receive 304, it means the hash file is the same as what we have downloaded before.

If we receive response code 200, we log it to a {type}new.txt file. This way, we have a list of all updated hash files on the API server and what we downloaded.

I am using this information to generate an update.json and update.php file that can be used to determine which hash was updated from the previous download.

To compare, we look at all log files and generate an array of differences with ranges of which hash files were updated. Refer to the next section (9. Update) to see how you can access this file and can use it via the tool to only download the updated files.

Clone this wiki locally