mimemagic_test.rb
6.02 KB
-
Support IO-like objects efficiently · 9ebbf0d9
Previously if we passed in an IO object which doesn't respond to #seek, MimeMagic would read the whole IO into memory. And this is exactly the type of objects that the Shrine file upload library deals with. However, we can also "seek" by blank-reading that many bytes, and always rewinding to the beginning, which is what we've implemented in this change. This change also doesn't require IOs to respond to #binmode.
Janko Marohnić committed