Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 11 years, 8 months ago. Active 3 months ago. Viewed k times. Improve this question. Yarin k gold badges silver badges bronze badges. Alok Swain Alok Swain 6, 5 5 gold badges 34 34 silver badges 52 52 bronze badges.
Add a comment. Active Oldest Votes. Try this: require 'open-uri' open 'image. Improve this answer. Jirapong Levi Levi 4, 1 1 gold badge 16 16 silver badges 15 15 bronze badges. This works. I tried this on an image. The image was not properly written to the file. As if it has been corrupted or something. Also could you guide me to do this same in a Rails application. Can i use this in a Rails application? Yes, you can use it in a rails application.
The file not being written properly is probably because I forgot to open the destination in write-binary mode. The files are 10M each, is this normal? It seems like it might take me an entire day to download at the rate it is going. For files that large, you may want to look into ways to dump the download to disk instead of into an array. To speed it up, you could try to save each link and launch a new thread for each download. That would give you concurrent downloads at least. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast what if you could invest in your favorite developer? Who owns this outage? Building intelligent escalation chains for modern SRE.
Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer. Linked I mean client asked me to reduce wait time by downloading all files simultaneous. For remote file download: You can use a gem called Sidekiq to write a background job which would use http to download each file.
Then update Redis with the status and poll for that status via ajax from the browser. Let me answer the parallel file download part of the question. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Multiple simultaneous remote file downloads to server ruby on rails Ask Question. Asked 6 years, 2 months ago.
Active 2 years, 9 months ago. Viewed times. How can be multiple files download to server simultaneous and check upload process I mean time left On rails application I have multiple text fields, they are for remote file urls like www. I also have defined route remotefiles to call it in ajax my ajax call sends form data in serialize format and this controller downloads all files 1 by 1.
I mean client asked me to reduce wait time by downloading all files simultaneous is there any way to get it done, all my code is custom and is not using any gem. Improve this question.
0コメント