This commit introduces support for resumable file transfers when using the 'Save to Directory' feature.
Key changes:
- The WebRTC protocol is updated to include an 'offset' in the 'fileRequest' message.
- 'FileReceiver' now checks for partially downloaded files in the selected directory. If a partial file is found, it requests to resume the transfer from the offset of the existing file size. It uses '{ keepExistingData: true }' to append to the file.
- 'FileSender' now handles requests with an 'offset' and uses 'file.slice(offset)' to send only the remaining data.
- Progress calculation is adjusted to reflect the resumed download state.
This provides a more robust user experience for large file transfers, allowing recovery from interruptions like network loss or accidental tab closure.
When saving files to a user-selected directory, the browser would trigger an additional, redundant download.
This was caused by a race condition where the UI checked the file's save method (saveType) before the flag was updated upon completion. The decision to save to disk was made too late in the process.
This commit resolves the issue by setting the saveType at the beginning of the file request. This ensures the UI has the correct information when the transfer finishes, preventing the extra download.