Azure blob 存储使用 WriteStream 上传数据

Azure blob storage using a WriteStream to upload data

我需要使用写入流将数据上传到 nodejs 中的 azure blob 存储容器 @azure/storage-blob

看起来 uploadStream 只接受 nodejs ReadStreams。

如何将 WriteStream 转换为 ReadStream,以便我可以将其传递给 uploadStream 函数。

使用 PassThrough 成功了!

const stream = new PassThrough()
this.containerClient.getBlockBlobClient(filePath).uploadStream(stream)
return stream