I am trying to use archive.extractFiles function to get path and file. This function is not waiting for list array to populate, instead immediately returning empty array.
import {Archive} from 'libarchive.js/main.js';
Archive.init({
workerUrl: '/libarchive.js/dist/worker-bundle.js'
});
public async getFileAndPath(fileList) {
const list = [];
console.log(fileList);
const archive = await Archive.open(fileList);
await archive.extractFiles(async entry => {
console.log(entry);
list.push(entry);
});
// console.log(obj);
return list;
}
How to make this function wait inside extractFiles.