file.all

Syntax

l = file.all(sname<,stype><,ipos>)
file.all(s<,s><,i>) = l

Get/set the entire contents of a file to/from a list.

sname is the name of the file.

stype is the type of file. The default file type is save. Currently available file types are:

  • save: The default. This is the same format used for save files and results files.
  • text: A text file, each line in the file is read as a string. On write each entry in the list is converted to a string if necessary and written as a line.
  • json: A text file structured in JSON format.
  • fish: A file in a FISH specific legacy format. Compatible with older versions, and extended to support some of the newer types.
  • binary: A file in binary format. Each entry in the list is treated as an integer from 0 to 255, and is written/read as a separate byte in the file.

ipos is an optional file position indicator. This changes the starting position the file will be read from or written to. Not all file types support this option.

The save and json formats allow all FISH types except pointers, and preserve hierarchical data structures (lists of lists of maps etc.).

The text type converts all entries to text strings on write, as if the string intrinsic were used.

The fish type is restricted to bool, integer, float, string, vector, and tensor types.

Returns:l - List of data read from the file.
Accepts:l - List of data to write to the file.
Arguments:sname stype i