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 string

An absolute file path, or file object.

charset string

Character encoding used to read the file
  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

Examples sample code invoking the fileRead function

Uses expandPath to grab a file in current directory.

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

Fork me on GitHub