2

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")
)
KevinU
  • 41
  • 3
  • your code in the question asked saved my day for my purpose!! I had been looking for it for quite few hours. Thanks, it helped. – letsbondiway May 28 '19 at 20:47

0 Answers0