fileRead

Reads an on-disk or in-memory text file or a file object created with the FileOpen function.

fileRead(filepath [, charset]) → returns String

fileRead Argument Reference

filepath
Required

An absolute file path, or file object.

charset

Character encoding used to read the file Values:
  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii

Examples sample code invoking the fileRead function


Read a file into a variable

Uses expandPath to grab a file in current directory.

fileContent = fileRead(expandPath("./file.txt"), "utf-8")

Fork me on GitHub