file(filePath)
Returns a file object. Note that the resulting file object can either refer to an already existing file or if the file does not exist, it can create a preliminary “virtual” file that refers to a file that could be created later (i.e. by an export command).
Type: function
Parameter(s):
- filePath {String}:
The file path.
Returns:
-
{File}:
File at the given path.
Example(s):
Get an image file from the desktop and place it in the document
var myImage = file("~/Desktop/myImage.jpg");
image(myImage, 0, 0);
Create a file and export it to the desktop
var myExportFile = file("~/Desktop/myNewExportFile.pdf");
savePDF(myExportFile);