I need to POST a large file (several GB) from disk to an external API from my Rails 5.2 app. The file can take up to an hour to transfer.
I can POST the file using RestClient, but would like to provide a progress bar to indicate transfer progress. How can I tell how much of the file has been transferred?
Working POST request (without progress):
RestClient::Request.execute(
:url => api_url,
:method => :post,
:headers => {
'Authorization' => token,
'Content-Type' => 'application/octet-stream',
},
:payload => File.open(filename, "rb")
)