Extract Zip & Rar Files in Oracle Visual Builder Cloud Service (VBCS)

Extract Zip & Rar Files in Oracle Visual Builder Cloud Service (VBCS)

Lately, I'm getting this question How to extract files from an archived file in Oracle VBCS table?

No alt text provided for this image

Well let's start .. I'm going to use two important Javascript libraries:

1. JavaScript library to zip and unzip files.

2. JavaScript Unrar Utility.

3. Create a VBCS unzipApp, You can download it from here.

4. Add libraries in Resources/js folder.

5. Add scripts in index.html file.

No alt text provided for this image

6. Drag & Drop File Picker & Table components.

No alt text provided for this image

7. Create Type & Array Data Provider variable.

  "types":{
    "filesDataType": 
      {
        "name": "string",
        "size": "number",
        "type": "string",
        "view": "any"
      }
  }         



"variables":{ 
    "filesDataADP": {
      "type": "vb/ArrayDataProvider2",
      "defaultValue": {
        "itemType": "filesDataType",
        "keyAttributes": "@index"
      }
    }
  }        

8. Invoke the below function on File Picker Selection Event.

No alt text provided for this image
Check whether file type is .zip or .rar

9. unzip & unrar functions will create a Blob object for the files inside the archived folder.

10. After processing the files, It's time to push them to the table using a custom event handler.

No alt text provided for this image
No alt text provided for this image

11. Now it's time to download the files, Since we have the Blob object itself so we can createObjectURL from it then download file from the browser directly.

No alt text provided for this image

12. Here you go, Download the app .. Follow the previous points step by step & you will be able to read files from .zip/.rar files.

No alt text provided for this image

I hope you find this article is helpful .. Thank You.

要查看或添加评论,请登录

Sherif Bashar的更多文章

社区洞察

其他会员也浏览了