Static
createCreates a new FileManager object.
If true
, the FileManager
will be using the to the local Drafts app documents directory as its root directory, as it appears in the "On my …" area in the Files.app
. If false
, it will use the Drafts5 iCloud folder as its root directory.
Static
createConvenience method to create iCloud file manager. iCloud file managers work with files in the iCloud Drive/Drafts
folder
Static
createConvenience method to create a file manager linked to a Bookmark object.
Static
createConvenience method to create local file manager. Note that local files are not visible on iOS in the Files app and are only available through the use of scripting.
Readonly
baseThe base POSIX-style path to the directory used by this FileManager.
Readonly
baseURLThe base local URL (file:///
format) to the directory used by this FileManager.
If a function fails, this property will contain the last error as a string message, otherwise it will be undefined
.
Copy file or directory at fromPath
to the toPath
. From and to path should be complete paths with file names included.
Optional
overwrite: booleanIf true, replace existing files in at the toPath. If false, abort operation if file exists at destination.
Move file or directory at fromPath
to the toPath
. From and to path should be complete paths with file names included.
Optional
overwrite: booleanIf true, replace existing files in at the toPath. If false, abort operation if file exists at destination.
Reads the contents of a JSON formatted file at the path. Returns undefined
value if the file does not exist or could not be read and parsed as JSON. Contents could be an object, array of objects, etc., depending on the content of the JSON file.
should begin with a /
and be relative to the root directory of the FileManager.
FileManager objects can be used to read from or write to files in either the local Drafts app Documents directory, or iCloud Drive (inside the
Drafts
folder).Note that local files are not visible on iOS, and are only available for reading and writing via scripting.Example