I can I check the internal buffer to see if my text data is present? Am I using node.js' Stream.read() correctly?
I have a text file as a blob stored on azure-storage. When I download the blob I get readable stream as well as info about the blob. The return data has a contentLength of 11 which is correct.
I am unable to read the steam. It always returns null. The node.js docs say,
The readable.read() method pulls some data out of the internal buffer and returns it. If no data available to be read, null is returned.
According to Node.js there is no data available.
async function downloadData(){
const textfile = "name.txt"
const containerURL = ContainerURL.fromServiceURL(serviceURL, "batches")
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, textfile );
let baseLineImage = await blockBlobURL.download(aborter, 0)
console.log(baseLineImage.readableStreamBody.read())
return
}
The method blobBlobURL.download
downloads the data. More specific to Azure it,
Reads or downloads a blob from the system, including its metadata and properties. You can also call Get Blob to read a snapshot.
In Node.js, data returns in a Readable stream readableStreamBody In browsers, data returns in a promise blobBody