Open psd. file programatically

I have the requestPermsissions set to fullAccess and I can successfully read a file from the user’s file system. My use case is that I read a csv file and that file contains a list of images (psd). I want to programatically operate on those images.In particular I want to make each image and active document and then run a batchPlay on it.
I cannot figure out how to open the file as a photoshop document.

I found the solution.

    const app = require('photoshop').app;
    const core = require('photoshop').core;
     const fs = require('fs');
    const fs2 = require("uxp").storage.localFileSystem;
    // Function to open a PSD file programmatically
    async function openDocument(filePath) {
        try {
            core.executeAsModal(async () => {
                const entryPath = await fs2.getEntryWithUrl(filePath);
                const openedDocument = await app.open(entryPath);
                console.log(openedDocument);
                // Make it the active document
                app.activeDocument = openedDocument;
                console.log(`Opened and set active: ${openedDocument.title}`);
            }, {});
        } catch (error) {
            console.error("Error opening document:", error);
        }
    }