Drafts Scripting Reference


FileManager objects can be used to read from or write to files in either the local Drafts app Documents directory (as visible in the Files.app), or iCloud Drive (inside the “Drafts5” folder).

Instance Functions

Class Functions


// create a local file in App documents
var fmLocal = FileManager.createLocal(); // Local file in app container
var success = fmLocal.write("/ScriptedFile.txt", "This is the file content");

// read from file in iCloud
var fmCloud = FileManager.createCloud(); // iCloud
var content = fmCloud.read("/Test Folder/Test.txt")