equivalent / equivalent/pull_tempfile
stream the file rather than store it in memory
- Dominant language
- Ruby
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
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 :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.