Some files error out mid-download, but are still partially written to disk.
yiff-dl currently only checks if the file exists and not if it's a valid file.
An easy way of making sure the file is valid is by comparing the filesize (bytes) and comparing it with the Content-Length HTTP header. From there we have a few options:
Yiff.party sends the Accept-Ranges: bytes header, so we can specify Range header and continue downloading from where we left off.
We'd essentially get the current 'length' (size in bytes) of the file and specify Range: 12355- which should give us the rest of the file.
Start downloading it from the beginning.
The first option has a few benefits:
Less load on Yiff.party (we don't want to be assholes)
Less bandwidth required (helpful for slower connections, especially for 'larger' files).
Though with that said, I don't know the max filesize limit for Patreon uploads are. I've seen a lot of creators rely on 3rd party filesharing sites such as Mega and Google Drive. ¯\_(ツ)_/¯
The second option allows us to make sure the file is downloaded correctly. I haven't experienced it myself, but assuming files can actually be corrupted even if "fully" downloaded, then the second option would be best.
I suspect that an issue like that would be very rare and it's just as easy to just manually remove the file and start yiff-dl again.
Some files error out mid-download, but are still partially written to disk.
yiff-dl
currently only checks if the file exists and not if it's a valid file.An easy way of making sure the file is valid is by comparing the filesize (bytes) and comparing it with the
Content-Length
HTTP header. From there we have a few options:Accept-Ranges: bytes
header, so we can specifyRange
header and continue downloading from where we left off.Range: 12355-
which should give us the rest of the file.The first option has a few benefits:
The second option allows us to make sure the file is downloaded correctly. I haven't experienced it myself, but assuming files can actually be corrupted even if "fully" downloaded, then the second option would be best.
I suspect that an issue like that would be very rare and it's just as easy to just manually remove the file and start
yiff-dl
again.