file_reader


file_reader(path, @key options, buffer_mode, transcoder)
      

Return a new input stream for the file named identified by path.

If present, options must be a list of symbols that control aspects of file operations. The only option that is valid is 'truncate which means that the file will be truncated when it is opened.

Buffer_mode is a symbol that controls buffering. Valid values are 'block, 'line and 'none. By default, buffering is turned off.

If transcoder is specified, it must be a transcoder object and file_reader will return a textual input stream that will be decoded with this object. Otherwise, a binary input stream is returned.

Examples:


// reading a utf-8 encoded text file:
let t = transcoder('UTF_8)
let f = file_reader("greek.txt", transcoder = t)
let contents = read_all_chars(f)
close_reader(f)
      

Also see:

file_writer
read_all_bytes
call_with_stream


Core Module Index | Contents