There's a way to see if a File exists?

I found a topic about if the file exists but it is from 2021. Today does we have a fs.getEntry("somefile").exists(); function or something similar?

I’m creating a file inside the dataFolder but I don’t want to create it each time and I want to verify if this file already exists inside the folder.

I made a simple function that returns false if there’s an error by trying to get the entry and if it exists it returns the data:

async function readFileFromPluginData(fileName) {
  const dataFolder = await fs.getDataFolder();
  try {
    const file = await dataFolder.getEntry(fileName);
    return await file.read();
  } catch (e) {
    return false;
  }
}

At the moment this works for me.

Can you get file metadata instead? And is it possible to have read access denied but with existing file?

I don’t know how to get metadata from a file, is there something specific like that in the docs?

This: https://developer.adobe.com/photoshop/uxp/2022/uxp-api/reference-js/Modules/uxp/Persistent%20File%20Storage/Entry/#getmetadata

const metadata = await aFile.getMetadata();