所以我找到了答案:
送blob文件与前缀和后缀如下:
let prefix = `
--23483860318350978727016216849495
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data; name="metadata"
{"name":"${filePath}", "cacheControl":"max-age=7200","contentType":"${fileType}"}
--23483860318350978727016216849495
Content-Type: ${fileType}`
let suffix = '\n--23483860318350978727016216849495--'
let blobWithMetadata = new Blob([prefix, blob, suffix])
并添加以下标题:
headers = {
'x-goog-upload-protocol': 'multipart',
'content-type': 'multipart/related; boundary=23483860318350978727016216849495'
}