Downloading files from the Internet using Ruby
-
I am wondering if it possible to download a file from the Internet using Ruby and then do something with the file automatically (again with Ruby).
For example, when you open the 3D Warehouse from SketchUp, you have the ability to download a SKP file and it loads automatically into your current open SKP file. I would like to emulate this behaviour but for a different purpose.
I don't want the user to determine the saved location for the download. The file would be downloaded to the user's temp folder and then loaded by the ruby script.
Any ideas?
Thanks. -
XMLHttpRequest
http://en.wikipedia.org/wiki/XMLHttpRequest -
@thomthom said:
XMLHttpRequest
http://en.wikipedia.org/wiki/XMLHttpRequestCould this be used download binary files? (zip files for example) It sounds like it can only be used for text or XML.
-
Reading binary files using Ajax
A growing number of web applications are making more and more use of client-side technologies because thanks to Ajax, it is now possible to write more fluid and more responsive web applications using only client-side technologies. Now, web developers from all around the globe are releasing really interesting utilities and applications using only client-side technologies, many…
nagoon97's Weblog (nagoon97.wordpress.com)
-
OK, it looks possible to read binary files using javascript. But, I wonder if I can pass the binary string from a WebDialog back to Ruby using a callback function and then write the file to the user's temp directory? Does this sound possible?
-
I recall a video of Scott Lininger doing that with downloading data from an external server from sketchup and having that data create a 3d bar chart dynamically.
Maybe Scott could clarify the method used.
-
@whaat said:
I wonder if I can pass the binary string from a WebDialog back to Ruby using a callback function and then write the file to the user's temp directory? Does this sound possible?
why not ? just try it
have in mind that window.location might have a size limitation (depends on the browser) - so more than 2000 chars can bring trouble -
@unknownuser said:
@whaat said:
I wonder if I can pass the binary string from a WebDialog back to Ruby using a callback function and then write the file to the user's temp directory? Does this sound possible?
why not ? just try it
have in mind that window.location might have a size limitation (depends on the browser) - so more than 2000 chars can bring troubleI've not tried this, but Chris mentioned you can store data in hidden input fields and extract data from there. http://forums.sketchucation.com/viewtopic.php?f=180&t=21166#p177786
Advertisement