Hello Arar,
here an example to store the file in the temporary directory:
1. Define in Inputs/Outputs an input variable, in our case in_file.
2. Add in the workflow a scriptable task and assign as input to this in_file. In this case I didn't rename the variable.
3. Following lines of code as an example to save any file in the temporary directory.
The function saveFileContent saves, with the method write, from the mime parameter, the file in the temporary directory. The lines above checks if a file with the same name exists and if the file exists it will be deleted.
The function fileExists checks if a file with a specific name exists in the temporary directory and if it exists a message is displayed.
// Begin----------------------------------------------------------------
function saveFileContent(mime) {
var file = new File(System.getTempDirectory() + "/" + mime.name);
if (file.exists) {
file.deleteFile();
}
mime.write(System.getTempDirectory(), null);
}
function fileExists(fileName) {
var file = new File(System.getTempDirectory() + "/" + fileName);
if (file.exists) {
System.log("File " + fileName + " exists");
}
}
saveFileContent(in_file);
fileExists(in_file.name);
// End------------------------------------------------------------------
4. Result
Any file should be able to be saved this way.
Best regards
Stefan