Imagine the case, when I would like to upload multiple large files.
For instance, it could AWS S3 objects, or some large files from disk, or some other large content.
Now imagine I am uploading the several GB of data...
Preferable way: use streaming. You could use io.Pipe (to divide source of data and destination) + + go-routine (to launch copy process under the hood + io.golang context (to cancel copy operation) + io.MultiReader (to combine multiple parts together)
Imagine the case, when I would like to upload multiple large files. For instance, it could AWS S3 objects, or some large files from disk, or some other large content.
The following code - https://github.com/ggicci/httpin/blob/v0.15.2/core/requestbuilder.go#L151 - populate whole content inside bytes.Buffer.
Now imagine I am uploading the several GB of data...
Preferable way: use streaming. You could use io.Pipe (to divide source of data and destination) + + go-routine (to launch copy process under the hood + io.golang context (to cancel copy operation) + io.MultiReader (to combine multiple parts together)