unknown method byte_size
johan-smits opened this issue · comments
I found already this issue (#44 ) but I'm using active storage in this case with a S3 back-end. So the proposed fix is not useful to me.
What I'm wanting to do is this:
property.asset.attach(io: Down.open("https://somedomain.tld/file.mp4"),
filename: "file.mp4",
content_type: "video/mp4")
So that it can read from the IO and stream the upload and download. Because it uses the S3 gem in backend it tries to read the byte_size to determine if it needs to use single part upload or multipart.
Would it be possible to provide a fix in this gem so that ActiveStorage will work to?
Hmm, why does aws-sdk-s3 call the byte_size
method? That's not implemented on IO
objects, so it wouldn't even work with File
objects. The Down::ChunkedIO
object returned by Down.open
implements #size
, which returns the total bytesize (assuming Content-Length
was present in the response). All libraries wanting to handle IO-like objects should call that method.
I'm closing this, as it doesn't appear there is anything that should be done in Down.