The File category lists reading & writing files on an Adobe Campaign instance. The same read or write can be expressed at several levels of abstraction, and picking the right one determines safety, performance, and operational risk.

Start high, drop down only when you have to: Workflow > File API > loadFile, from no-code to code.

Choosing a file-access level

To read or write a file, reach for the highest level that fits:

Level Best for API Use cases Abstraction Speed
Workflow πŸ§‘β€πŸ’Ό Easy use Data loading (file), File transfer, File collector Scheduled CSV / flat-file import & export with a workflow. Visual, no code Low code 1 sec
loadFile ⚑ Convenience loadString / loadFile to read, saveString / saveFile to write Read or write a whole file’s content in one call JS helpers ~0.15 ms
File API πŸ› οΈ Automation File, ZipFile Manage files in the instance dirs: write, copy, remove, zip JS object ~0.1 ms

File API

At the JavaScript level, two styles share the same sandbox. The File / ZipFile object API treats a file as an object β€” create, copy, remove, compress an archive β€” while the loadString / saveString helpers read or write a whole file’s content in one call:

var csv = loadString(application.instanceVarDir + "import/customers.csv");
saveString(report, application.instanceVarDir + "export/report.txt");

Both are confined to the instance var and upload directories. A path outside them β€” conf/serverConf.xml, C:\Windows\… β€” aborts with rc -56. Treat that whitelist as the boundary for any file work on the instance.

Modern development

Keep file logic in xtk:javascript libraries and read or write only through the whitelisted File / loadString APIs, with the instance var and upload directories as the boundary. See Modern development best practices for Adobe Campaign.