Is there an API to check if a file or folder exists? I don’t see anything in the API.
// from the documentation it looks like I have call file.getEntry() and test for an error event or find a matching name
Test for error:
try {
var entry = await folder.getEntry(filename);
fileExists = true;
}
catch(fileError) {
fileExists = false;
}
Test for matching name:
try {
subfolder = (await folder.getEntries()).find(entry => entry.name.includes(subfolderName));
if (subfolder!=null) {
return true;
}
}
catch(error) {
return false;
}