Hi all,
I want following:
There is a source folder in which there is one file and one subfolder. The subfolder also has one file. I want to get the both source and subfolder files. I have written following
code:
const fs = require('uxp').storage.localFileSystem;
let docs = [];
let folder = await fs.getFolder();
const entries = await folder.getEntries();
var files = await entries.filter(async entry => {
if (entry.isFile) {
docs.push(entry);
}
else {
const newEntries = await entry.getEntries();
await newEntries.filter(async (e) => {
if (e.isFile) {
docs.push(e);
}
})
}
});
But the issue is that when it enter into else case to read subfolder files, it act asynchronously(the program execution moves ahead) even though I used await keyword. Means I have to wait for 1-2 milliseconds to read subfolder files.
Can anyone please help? Am I missing something?