Golang io.copy twice on the request body

后端 未结 4 660
一向
一向 2021-02-03 11:33

I am building a blob storage system and i picked Go as the programming language. I create a stream to do a multipart file upload from client to the blob server.

The stre

4条回答
  •  醉话见心
    2021-02-03 12:22

    You have two options.

    The most direct way is to use io.MultiWriter.

    But if you need the hash to produce the multipart output, then you will have to copy to a bytes.Buffer and then write the buffer back to each writer.

提交回复
热议问题