I regularly use "caffeinate rsync ..." to make sure that syncing finishes before the Macbook is allowed to sleep. So caffeinate just prevents sleeping until rsync terminates.
You can tell caffeinate to watch for other processes too, to make sure a browser thread doing a download will finished uninterrupted before sleeping.
You can tell caffeinate to watch for other processes too, to make sure a browser thread doing a download will finished uninterrupted before sleeping.