Class: File

This class represents a file on the file system. It also provides methods that are less abstract than the functions of the fileSystem module

new File()


Members

isOpen :boolean

Whether the file is open and ready to write to.
Type:
  • boolean

Methods

close(callback)

Closes the underlying file stream.
Parameters:
Name Type Description
callback siteKiosk.io.fileSystem~File~closeCallback A callback which will be called when the operation to close the file stream has been completed

getIsOpen() → {boolean}

Gets, whether the file is open and ready to write to.
Returns:
Whether the file is open and ready to write to
Type
boolean

readLine(callback)

Reads the next line from the underlying file stream.
Parameters:
Name Type Description
callback siteKiosk.io.fileSystem~File~readLineCallback A callback which will be called when the operation to close the file stream has been completed

write(text, callback)

Writes text to the underlying file stream.
Parameters:
Name Type Description
text string The text to write to the file
callback siteKiosk.io.fileSystem~File~writeCallback A callback which will be called when the operation to write to the file stream has been completed

writeLine(line, callback)

Writes a line of text to the underlying file stream.
Parameters:
Name Type Description
line string The line of text to write to the file
callback siteKiosk.io.fileSystem~File~writeCallback A callback which will be called when the operation to write a line to the file stream has been completed

Type Definitions

closeCallback(errorMessage)

A callback which will be called when the operation to close the file stream has been completed.
Parameters:
Name Type Argument Description
errorMessage string <nullable>
An error message or null if the operation has been completed successfully

readLineCallback(errorMessage, line)

A callback which will be called when the operation to read a line from the file stream has been completed.
Parameters:
Name Type Argument Description
errorMessage string <nullable>
An error message or null if the operation has been completed successfully
line string <nullable>
The line of text or null if the operation has not been completed successfully

writeCallback(errorMessage)

A callback which will be called when the operation to write to the the file stream has been completed.
Parameters:
Name Type Argument Description
errorMessage string <nullable>
An error message or null if the operation has been completed successfully