Extract Archive File using Archive API

This code shows how to extract compressed (archived) file using Archive API of Tizen. A zip file named “test.zip” is stored in Downloads folder of File System. After running this code extracted files will be also stored in same folder. These source "downloads” and destination "downloads” folder can
//config.xml
<tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
<tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>

//main.js
function errorCallback(error) {
        console.log(error);
    }
    function successCallback() {
        console.log("done");
    }
    function progressCallback(opId, val, name) {
        console.log("extracting operation (: " + opId + ") is in progress (" + (val * 100).toFixed(1) + "%)");
    }
    function openSuccess(archive) {
        archive.extractAll("downloads", successCallback, errorCallback, progressCallback);
    }
    tizen.archive.open("downloads/test.zip", "r", openSuccess);

Responses

0 Replies