I tried the code from uncompress.js. But I do not understand why the js need to load the format and after that reactive the button. Can anyone simplelize the code so that I can use it locally without blob, promise or async. I just need to test compresd a file with browser.
loadArchiveFormats(['rar', 'zip', 'tar'], function() {
fileInput.onchange = function() {
// Just return if there is no file selected
if (fileInput.files.length === 0) {
entryList.innerHTML = 'No file selected';
return;
}
// Get the selected file
let file = fileInput.files[0];
let password = filePassword.value;
// Open the file as an archive
archiveOpenFile(file, password, function(archive, err) {
if (archive) {
console.info('Uncompressing ' + archive.archive_type + ' ...');
entryList.innerHTML = '';
onArchiveLoaded(archive);
} else {
entryList.innerHTML = '<span style="color: red">' + err + '</span>';
}
});
};
fileInput.disabled = false;
}); '''