1
votes

I have requirement where in azure blob storage suppose A , I have a folder structure as below

CNS -> master -> 123-456 -> cm -> Inside cm multiple files and folder are present.

I need to get all the files and folder from cm folder , zip and upload to blob storage B.

Can any one provide best solution how I can perform this using java script only.

Thanks in advance

1
Please edit your question and include: 1) Is it for File Storage or Blob Storage and 2) What you have tried so far? Show us some code that you have written and the issues you're running into. Lastly, why tag azure-functions?Gaurav Mantri
I haven't try much on this. I didn't find anything on this. Azure time trigger function I am using that is why it is tagged. And it is a blob storageSatish Bhuria
You have to try something. Let me make this somewhat easier for you by breaking your requirements in following tasks: 1) First you list the blobs. 2) You download the blobs. 3) You zip the downloaded files and 4) You upload the zip file. I suggest you use Node SDK for Azure to do 1, 2, and 4. For 3, you will need to find a Nod package that will zip the files for you. HTH.Gaurav Mantri

1 Answers

2
votes

See this documentation for how to create a timer-triggered function in node.js which runs every hour: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer

Example function.json file content:

{
  "bindings": [
    {
        "schedule": "0 0 * * * *",
        "name": "myTimer",
        "type": "timerTrigger",
        "direction": "in"
    }
  ],
  "disabled": false
}

As for how to use blob storage APIs from JavaScript, see the following documentation: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-nodejs-how-to-use-blob-storage.

In particular, the following topics seem relevant to what you're trying to accomplish:

As for how to do the file zipping, there is a related topic in another StackOverflow post here: Zip archives in node.js.