0

我有一个数据流并且想要到达某个端点我不想在本地存储数据以查找内容长度,因为我需要将内容长度作为 headers 属性传递。那么获取内容长度的可能方法是什么?

(readStream) => {
const requestOptions = {
      url: 'https://url.com',
      method: 'PUT',
      headers: {
        'Content-Type': 'application/octet-stream',
        'Content-Length': length,
      },
      body: readStream
    }
  request(requestOptions, function (error, response, body) {
    
  });
}
4

0 回答 0