Extract Zip & Rar Files in Oracle Visual Builder Cloud Service (VBCS)
Sherif Bashar
Oracle ACE Pro ? | Co-Founder | Head of Digital Solutions at WIND Integrated Solutions
Lately, I'm getting this question How to extract files from an archived file in Oracle VBCS table?
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.
6. Drag & Drop File Picker & Table components.
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.
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.
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.
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.