How to download a file from URL and display progress in UI with Ruby script?

Hi !

I would like to create something similar to a self-updater to my extension.
As I imagine it I only needs to download the new RBZ file from a ruby script and use the Sketchup.install_from_archive(downloaded_file) method.

To download the file I use open-uri. But as I write it, it freezes the UI during download. Do you know a workaround to be able to display a progress or something like that ?

Here is how the download is made :

    require 'open-uri'
    open('my_local_file.rbz', 'wb') do |file|
      file << open('http://domaine.com/remote_file.rbz').read
    end

Thanks for your answers,
And have a nice day :slight_smile:

1 Like

You can look at the SketchUp HTTP class.

1 Like

Oh yes, thank you @eneroth3. I will take a look to this !

1 Like

Thank you so much @eneroth3 . It was the exact solution I needed.

Works only on SU >= 2017, but a good solution.

2 Likes