I am downloading images through HTTP request with which I am getting a binary image, and writing it to a file such as
File.write(image_with_dir, image, [:binary]) |> File.close
this whole operation of getting HTTP request and then writing it to disk is done in
|> List.flatten()
|> Enum.sort()
|> Task.async_stream(&(inline_process.(&1, images_directory)), max_concurrency: System.schedulers_online() * 2, timeout: :infinity)
|> Stream.run
When decreasing max_concurrency the process got slow approx 2 minutes, also results of System.schedulers_online() is 8
but with current max_concurrency it faster but with this. Disk IO starts touching the limits

Purpose of writing those files is to send them to Dropbox with a batch of 1000 as dropbox upload session supports 1000 images at a time.
Is there any better way to write images to disk? maybe in memory but I don't know, any help would be wonderful also this operation is being done on Cuda GPU machine but I am not sure how I can use GPU for such purpose.
This process is user defined. user can ask for less/more than 1000 images and those can be one or multiple Task.async_stream's