Contents

Roo

File.append_line()

Appends the passed data to this File object’s file on disk followed by the OS-appropriate end of line delimiter. The data passed will be converted to its Text representation before the write occurs. Returns the number of bytes written as a Number. If the File object’s file does not exist on the disk then it will be created and the data will then be written.

File.append_line(data as Object) as Number

Parameters

  • data. Object. The data to be appended to the end of the file. The object will be converted to it’s Text representation before writing it to disk. The OS-appropriate end of line delimiter will be appended to the text written to disk.

Returns

  • A new Number object reflecting the number of bytes written to disk.

Example

# Assume `text.txt` does not yet exist.
var f = File("/Users/garry/Desktop/test.txt")
f.append_line("Line 1") # 7
f.append_line("Line 2") # 7
# `test.txt` now contains:
# Line 1
# Line 2