如何将包含在Multipart.FileHeader中的文件的主体/内容读入Go中的字节片([]字节)?
我唯一要做的就是把内容读入一个大小很大的字节片中,然后我想知道文件的确切大小,之后,我想用MD5散列文件内容。
// file is a *multipart.FileHeader gotten from http request.
fileContent, _ := file.Open()
var byteContainer []byte
byteContainer = make([]byte, 1000000)
fileContent.Read(byteContainer)
fmt.Println(byteContainer)