0
votes

I need to use a write stream to upload data to a azure blob-storage container in nodejs using @azure/storage-blob.

It looks like the uploadStream only accepts nodejs ReadStreams.

How would I convert a WriteStream to a ReadStream so that I can pass it into the uploadStream function.

1
Check if stream.PassThrough could help you?George Chen

1 Answers

2
votes

Using PassThrough worked!

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