stream the file rather than store it in memory
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reading the current URL-to-tempfile implementation and the Ruby IO.copy_stream and Net::HTTP streaming documentation cited in the issue. Done means downloads are streamed without loading the entire file into memory and an upper bound is enforced; no specific files or tests are named in the issue.
Written by the indexing model from the issue text.
Description
from discussion in https://www.reddit.com/r/ruby/comments/4bcgjw/download_url_to_tempfile_gem/
tips from Reddit user moomaka
This implementation downloads the entire file into memory then writes it to disk. This is not only a bad idea for performance but is also a DoS vector.
Implementation recomendation
Probably the most efficient is IO.copy_stream or similar methods from IO: http://ruby-doc.org/core->2.3.0/IO.html. Another option is Net::HTTP streaming responses: http://ruby-doc.org/stdlib->2.3.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Streaming+Response+Bodies
Regardless of which approach you use, you probably want to set an upper bound on the size of the >file also or someone could just point you at a 15TB file :)
- Dominant language
- Ruby
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
yegor256/rubocop-elegant#92 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ecosyste-ms/awesome#812 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
forem/forem#23933 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rails/mission_control-jobs#347 ·