Closed PhantomArt closed 1 year ago
I think I came up with a better version. You can create a FormBody::addFileFromStream()
method that takes a StreamBody
as an argument, similar to the FormBody::addFileFromString()
method.
This will be possible in 5.x, see #322.
In my code, I have the content of the file as a
ReadableStream
. I would like to create aFileBody
from thisReadableStream
. Right now I have two ways:ReadableStream
to a file on disk, then pass it toFileBody
.ReadableStream
into a variable and pass it toFileBody
.It seems to me that both options are not optimal.
FileBody
is essentially an intermediary to supply aReadableStream
using thecreateBodyStream()
method, so why isn't it possible to pass aReadableStream
directly toFileBody
?