File object
The File object handles reading, writing, and managing files on disk
| Property | Description | Access | Type |
|---|---|---|---|
| File.accessed | Get/set last time the file was accessed | readwrite | |
| File.created | Get/set the file creation date and time | readwrite | |
| File.directory | Get the directory that contains the file | readonly | |
| File.encoding | Get the file encoding | readonly | string |
| File.eof | Check if end of file (EOF) position has been reached | readonly | boolean |
| File.exists | Check if the file exists | readonly | boolean |
| File.extension | Get only the File extension | readonly | string |
| File.fullpath | Get full path of the file | readonly | string |
| File.hidden | Check if the file is hidden | readwrite | boolean |
| File.lines | Iterator over each line of the file | readonly | function |
| File.modified | Get/set the last time the file have been modified | readwrite | |
| File.name | Get the File name (with its extension) | readonly | string |
| File.path | Get the file path | readonly | string |
| File.position | Get/set the current file position | readwrite | number |
| File.readonly | Check if the file is readonly | readwrite | boolean |
| File.size | Get the File size on disk | readonly | number |
| File.temporary | Get/set the temporary status of the file | readwrite | boolean |
| Methods | Description | Return value |
|---|---|---|
| File:close() | Close the file | - |
| File:constructor() | File object constructor | |
| File:copy() | Copy a file to a new one | boolean |
| File:copytask() | Copy a file to a new one asynchronously | |
| File:flush() | Flush written data to the file | - |
| File:move() | Move the file to a new location/name | boolean |
| File:open() | Open the file for read/write/append operations. | |
| File:read() | Read data from the file | |
| File:readln() | Read a line from the file | |
| File:remove() | Delete the file | boolean |
| File:write() | Write data to the file | number |
| File:writeln() | Write data and append a new line to the file | number |