Downloads the given application asset
Example
let dirAppAsset = {
'src':'http://local:8000/dir.zip',
'alias': 'dirApp',
'version': '1.23.24',
'target': 'dir.bat',
'args':''
};
function launchDirApp() {
fin.desktop.System.launchExternalProcess({
alias: dirAppAsset.alias,
listener: function(e) {
console.log(`the exit code ${e.exitCode}`);
}
},() => {
console.log('all good');
},(reason, err)=> {
console.log(reason, err);
});
}
fin.desktop.System.downloadAsset(dirAppAsset, progress => {
let downloadedPercent = Math.floor((progress.downloadedBytes / progress.totalBytes) * 100);
console.log(`Downloaded ${downloadedPercent}%`);
}, p=> {
console.log(`Downlod complete, can be found on ${p.path}`);
//lets launch our application asset.
launchDirApp();
}, (reason, err)=> {
console.log(reason, err);
});