File
A file
Returned by a directory's file(). Reads and writes text, JSON, images and raw data, and reports size, dates and extended attributes.
Properties
pathStringFile path
nameStringFile name
extensionStringFile extension
existsBooleanWhether this file exists
sizeNumberFile size in bytes
utiStringUniform type identifier
createdAtDateTime ›File creation date
modifiedAtDateTime ›File modification date
iCloudAnyiCloud metadata
tags[String]File tags
attributesAnyFile attributes
Methods
.read(as?)AnyRead file contents. Modes: 'string', 'json', 'image', 'data'.
- as String
.write(content)Write content to this file.
- content Any required
.append(content)Append text to this file.
- content String required
.copyTo(destination)Copy this file to a destination.
- destination Any required
.moveTo(destination)Move this file to a destination.
- destination Any required
.delete()Delete this file.
.download()BooleanTrigger iCloud download for this file.