io

FileMode

enum FileMode {
    read,
    write,
    update,
}

File mode with which you can open a file

File

object File 

Object to manipulate an opened file

open

static fun open(str filename, FileMode mode) > File !> FileSystemError, UnexpectedError

Open file

  • filename: Path of file to open
  • mode: Mode with which to open it

Returns: opened file

collect

fun collect() > void

Close file. Automatically called by Garbage Collector.

close

fun close() > void

Close file

readAll

fun readAll(int? maxSize) > str !> ReadWriteError, FileSystemError, UnexpectedError

Reads file until EOF

Returns: read data

readLine

fun readLine(int? maxSize) > str? !> ReadWriteError, FileSystemError, UnexpectedError

Reads next line, returns null if nothing to read

Returns: read data

read

fun read(int n) > str? !> ReadWriteError, FileSystemError, InvalidArgumentError, UnexpectedError

Reads n bytes, returns null if nothing to read

  • n: how many bytes to read

Returns: read data

write

fun write(str bytes) > void !> FileSystemError, ReadWriteError, UnexpectedError

Write bytes

  • bytes: string to write

isTTY

fun isTTY() > bool

Returns: true if File is a terminal

stdin

const File stdin

stdout

const File stdout

stderr

const File stderr

runFile

fun runFile(str filename) > void !> CompileError, InterpretError, FileSystemError, ReadWriteError 

Run a buzz file

  • filename: path to buzz file
Last Updated:
Contributors: Benoit Giannangeli, hshq