Photohsop UXP API not working ( fs.createEntryWithUrl)


I am using the UXP API to create the text file at a specific location but the text file is not creating.
My requirement is that - create a text file without showing/pop-up dialog box and I file should be saved at “User’s Document” folder or any other drive or outside of plugin-data, plugin-temp, plugin folder.

I write this script to create the file inside the user’s document folder but it’s not working (file is not creating).

await fs.createEntryWithUrl("file:/Users/<username>/Documents/test.txt", { overwrite: true });

API reference -

your code by itself does not create a file, it creates an entry that can be used with methods that accept entries.

you need to call entry.write() to write your data/file

let testFile = await fs.createEntryWithUrl("file:/Users/<username>/Documents/test.txt", { overwrite: true 
await testFile.write("file contents")

alternatively you can use require('fs') 's writeFile() (recommended for simple text files)

if issue still persists
make sure you have the appropriate permissions in manifest.json

"requiredPermissions": {
    "localFileSystem": "fullAccess"

for further debugging I need to know what version of Phoroshop are you using / supporting

1 Like

I already mentioned (“requiredPermissions”: {“localFileSystem”: “fullAccess” }) in the manifest.json file but still, the code is not working after I use the write() function (Getting an error - fs.createEntryWithUrl is not a function).

let testFile = await fs.createEntryWithUrl(“file:/Users//Documents/test.txt”, { overwrite: true
await testFile.write(“file contents”);

I also tried with require(‘fs’) module

await fs.writeFile(“file:/Users/Ravi/Documents/test1.txt”, “It was a dark and stormy night.\n”, {encoding: “utf-8”});

I am using Photoshop version - 23.5.3

1 Like

The ‘fs’ module was added in Photoshop version 24.2 (February 2023). So it might be a good idea to update. Check out this link for updates:


that’s exactly why I asked about PS version.
as mentioned you’ll need to update to 24.2 minimum to use create/get entry with url maybe newer since change log is not always accurate.

if you want to use the FS API you’ll need version 24.4 or newer.

Thank You (@Maher) my problem is resolved after updating the photoshop version from 23.5 to 24.4

1 Like