I’m using azure function with node js to create a zip file(abc.zip) with some files in function app temp folder and on the next step I need to upload the zip file in azure blob storage. Problem is the blob storage path has to be something like ‘/xyz/pqr/ghk’. How to achieve this?
1 Answers
0
votes
As @GauravMantri indicated,Try this :
const {
BlobServiceClient
} = require("@azure/storage-blob");
const connectionString = ''
const container = ''
const destBlobName = 'test.zip'
const blob = 'xyz/pqr/ghk/' + destBlobName
const zipFilePath = "<some function temp path>/<filename>.zip"
const blobClient = BlobServiceClient.fromConnectionString(connectionString).getContainerClient(container).getBlockBlobClient(blob)
blobClient.uploadFile(zipFilePath)
Let me know if you have any more questions :)
abc.zip
inxyz/pqr
folder, just change the name of the blob toxyz/pqr/abc.zip
. – Gaurav Mantri