Save in TIFF format

HI
can some one please guide me , i want to save my file in TIFF format using UXP plugin.

async function saveTif(FileFullPath) {
await core.executeAsModal(
async () => {
return await psAction.batchPlay(
[
{
_obj: “save”,
as: {
_obj: “TIFF”,
byteOrder: {
_enum: “platform”,
_value: “IBMPC”,
},
LZWCompression: true,
layerCompression: {
_enum: “encoding”,
_value: “zip”,
},
},
in: {
_path: FileFullPath,
_kind: “local”,
},
lowerCase: true,
_options: {
dialogOptions: “dontDisplay”,
},
},
],
{
“synchronousExecution”: false,
“modalBehavior”: “fail”
});
},
{ commandName: “Saving TIFF” }
);
}

this above is my save function , and below is my method to call this function

  let consolidatedFileName = `Consolidated-file-${consolidatedCounter}.tif`;
    consolidatedCounter++;
    consoldatedImgs.textContent = `Saving Consolidated Image...`;



    var conFile = await outPathToken.createFile(consolidatedFileName, {
      overwrite: true,
    });
    const saveTIFF_File = await fs.createSessionToken(conFile);

    await core.executeAsModal(async () => {
      await saveTif(saveTIFF_File);
      consoldatedImgs.textContent = `File Saved : ${consolidatedFileName}`;
      return;
    }, {});

I wrote it while filling in the unknown parts and it worked.

For me, the key points were to specify interactive: true and to add await when specifying the destination folder.

What is the error in your case? It seems to me that there is a data type discrepancy around outPathToken.createFile.

const { localFileSystem } = require('uxp').storage ;
const photoshop = require('photoshop') ;
const { app, core, action } = photoshop ;

async function saveTif(FileFullPath) {
  return await action.batchPlay(
    [
      {
        _obj: "save",
        as: {
          _obj: "TIFF",
          byteOrder: {
            _enum: "platform",
            _value: "IBMPC",
          },
          LZWCompression: true,
          layerCompression: {
            _enum: "encoding",
            _value: "zip",
          },
        },
        in: {
          _path: FileFullPath,
          _kind: "local",
        },
        lowerCase: true,
        _options: {
          dialogOptions: "dontDisplay",
        },
      },
    ],

    {
      "synchronousExecution": false,
      "modalBehavior": "fail"
    }
  ) ;
}

const main = async () => {
  try {
    await core.executeAsModal(
      async (control) => {
        let consolidatedCounter = 0 ;
        let consolidatedFileName = `Consolidated-file-${consolidatedCounter}.tif` ;
        consolidatedCounter++ ;
        console.log(`Saving Consolidated Image...`) ;

        const outPathToken = await localFileSystem.getPluginFolder() ;
        const conFile = await outPathToken.createFile(consolidatedFileName, {
          overwrite: true,
        }) ;
        const saveTIFF_File = await localFileSystem.createSessionToken(conFile) ;

        const result = await saveTif(saveTIFF_File) ;
        console.log(`File Saved : ${consolidatedFileName}`) ;
        console.log(result) ;
      },

      {
        'commandName': 'Saving TIFF', 
        'interactive': true
      }
    );
  } catch (e) {
    await app.showAlert(e);
  }
} ;