【发布时间】:2019-04-08 23:41:23
【问题描述】:
我将数据存储在 Azure 上,并将 Content-Type 放在 headers 字段中,同时上传如下块:
const headers: any = {
'Content-Range': contentRange,
'Content-Type': "image/svg+xml",
};
const responseData: any = await putChunk(url, chunks[currentChunkIndex].blob, headers);
以下是我创建 blob 并将它们推入块数组的方式:
var blob = new Blob([file.slice(start, end)], { type: 'image/svg+xml' });
const chunk = new FileChunk(blob, file.size, start, end, file.name);
chunks.push(chunk);
以下是简单发送 PUT 请求的 putChunk() 函数:
async function putChunk(url: string, data: any, headers: any): Promise<any> {
const options: any = {
method: 'PUT',
headers: headers,
body:
return await fetch(url, options);
}
无论内容类型设置为什么,同样是 blob 和块,它总是重置为 application/octet-stream。我错过了什么?
【问题讨论】:
标签: typescript azure azure-blob-storage