-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Zmodem.Browser.send_files allows you to pass an on_progress handler. Sadly, it isn't actually usable for a couple of reasons.
First of all, it seems Chrome (and possibly others, I haven't checked) only triggers the progress handler when it's done loading the file. I've tried with files up to ~25 MB in size. Honestly, this makes sense, since on any modern system, loading a file into memory is very fast.
Second, I'm not very interested in learning about the progress in loading the file. I'm much more interested in learning about the progress in sending the file. However, the end_files routine sends as much data as it has available without splitting it into smaller chunks. Due to the first problem, this means the whole file gets sent in one go and my first progress event is when it's done.
I propose adding a chunkSize option to send_files. Files will get split into chunks of up to chunkSize and the on_progress handler should get triggered for each chunk sent.