使用 REST API 将文件流上传到 AZURE BLOB STORAGE
Upload a file stream to AZURE BLOB STORAGE using REST APIs
我正在尝试使用以下代码将文件流上传到 Azure Blob:
const requestOptions = {
url: url,
method: 'PUT',
headers: {
'Content-Type': 'application/octet-stream',
'Content-Length': contentLength,
'x-ms-blob-type': 'BlockBlob',
'x-ms-date': strTime,
'x-ms-version': '2019-02-02'
},
body: readStream
}
我的数据流太大,无法存储在内存中,也无法拖延代码流来计算内容长度,请问有没有办法让REST请求上传没有内容长度的blob?
我遇到了一个解决方案 Link 他们尝试在没有文件或流的内容长度的情况下进行上传调用。使用 REST 或任何其他方法可以实现这样的事情吗?
so is there any way to make the REST request to upload blob without
the content length?
上传 blob 时需要内容长度,因此您不能在请求中省略它。从这个 link
:
如果您的输入数据太大,一种可能的解决方案是分块读取输入数据并使用 Put Block
operation and then finally performing Put Block List
上传它们以提交 blob。
我正在尝试使用以下代码将文件流上传到 Azure Blob:
const requestOptions = {
url: url,
method: 'PUT',
headers: {
'Content-Type': 'application/octet-stream',
'Content-Length': contentLength,
'x-ms-blob-type': 'BlockBlob',
'x-ms-date': strTime,
'x-ms-version': '2019-02-02'
},
body: readStream
}
我的数据流太大,无法存储在内存中,也无法拖延代码流来计算内容长度,请问有没有办法让REST请求上传没有内容长度的blob?
我遇到了一个解决方案 Link 他们尝试在没有文件或流的内容长度的情况下进行上传调用。使用 REST 或任何其他方法可以实现这样的事情吗?
so is there any way to make the REST request to upload blob without the content length?
上传 blob 时需要内容长度,因此您不能在请求中省略它。从这个 link
:
如果您的输入数据太大,一种可能的解决方案是分块读取输入数据并使用 Put Block
operation and then finally performing Put Block List
上传它们以提交 blob。