-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Ruby's lack of clear standard interface for IO bytes again.
I would love to use a Down::ChunkedIO with the multipart-post gem. Actually I'm trying to use it via the ruby-openai gem which depends on faraday-multipart which depends on multipart-post.
Multipart-post is written to work with non-File IO objects -- but assuming a #length method not a #size method.
The most accessible example of any non-File IO from stdlib is StringIO, which has both #length and #size, so I'm guessing people make differnet guesses of which to use for a non-File IO object.
I happen to agree #size is more sensible, but blame ruby for not having a clear interface? Supporting #length as an alias for #size may help improve Down::ChunkedIO's compatibility with things expecting non-File IO.
I have, however, also filed an issue at multipart-post asking if they'd consider checking for #size too
I have confirmed that at least for my straightforward use-case, Down::ChunkedIO is useable with multipart-post, so long as this issue is resolved on one side or the other. (There's a potentially outstanding issue at the ruby-openai, level but faraday-multipart and multipart-post shoudl be good!