Unable to upload Gunzip stream from GDrive to azure

34 Views Asked by At
  • Package Name: "@azure/storage-blob"
  • Package Version: "12.9.0"

I am using node js and trying to upload png file from gdrive to azure. In order to achieve it. I am first reading file as stream from GDrive API.

when I perform read file, I get Gunzip stream. And when I use uploadStream(stream) it saves my file without any error.

Problem is that when I try to download it. I get my png file as 1KB(Original Size:266Kb) which I am not able to open.

Am I doing something wrong?. Please help me.

const saveFromStream = async (inputStream, fileName, path) => {
  const filePath = getBlobName(fileName, path);
  const blobService = new BlockBlobClient(AZURE_CONNECTION_STRING, 
  AZURE_GAME_PORTAL_CONTAINER, filePath)
  const response = await blobService.uploadStream(inputStream,)
  return filePath;
}

below how gunzip(inputstream) look like

enter image description here

1

There are 1 best solutions below

3
Gaurav Mantri On

You are not doing anything wrong. When you download the blob using the SDK, it will download the blob that is stored in your storage account. Since your blob is compressed, the downloaded file is also compressed.

You would need to decompress the file yourself once it is downloaded. SDK will not do that for you.