Save an XML / txt file to the temporary plugin folder

Hello, I need your collective knowledge :slight_smile:
I’ve been trying for days to find a way to save an XML file to the temporary plugin folder, but it’s not working at all. I don’t care if it’s an XML file or a TXT file, and I’m flexible about the location as long as I can successfully save a dataset in the background and edit it later. Unfortunately, all my attempts so far have failed. Here’s my test plugin code for saving an XML file in the plugin folder:


<!DOCTYPE html>
    <title>XML File Creator</title>
    <button id="createXmlButton">Create XML File</button>

    <script src="js/main.js"></script>


const { storage } = require("uxp");
const fs = storage.localFileSystem;

document.addEventListener('DOMContentLoaded', () => {

    const createXmlButton = document.getElementById('createXmlButton');
    createXmlButton.addEventListener('click', async () => {
        try {
            const pluginDataFolder = await fs.getDataFolder();
            const xmlFileName = "myFile.xml";
            const xmlFileContent = '<root><data>My XML Data</data></root>';

            const xmlFile = await pluginDataFolder.createFile(xmlFileName, { overwrite: true });
            await xmlFile.write(xmlFileContent);

            //alert(`XML file successfully created and saved: ${xmlFile.nativePath}`);
        } catch (error) {
            console.error("Error creating or saving XML file:", error);

Permissions in my manifest

"manifestVersion": 5,
  "requiredPermissions": {
    "webview": {
      "allow": "yes",
      "domains": [
      "enableMessageBridge": "localAndRemote"
    "network": {
      "domains": "all"
    "launchProcess": {
      "schemes": ["https"]

I would be grateful for any hints! <3

@blackicon are you seeing any errors or exceptions in console while debugging

Thanks for your reply @vinayKumarG
No, the console does not display any errors or anything else. When I display the alert, the correct path to the plugin folder is also shown. So, everything seems perfect. However, unfortunately, no XML file is being created :frowning:

Have you tried adding these permissions in manifest.json?

  "requiredPermissions": {
    "localFileSystem": "plugin"
  "permissions": {
    "localFileSystem": [

Maybe it doesn’t apply to XD, I used it for Photoshop. But it never hurts to try.

I had a similar problem, but for reading the files, not writing, and it ended up solving it.