I should mention that the code I posted may not work well with the default single-threaded executor, as the browser's barrage of range requests could cause the server to lock up. I normally use a virtual thread executor, so the chunk size would need a second look if we want to stay with the single-threaded executor.
-- Cheers, Josiah.