nifti_viewer~ FILE

new FILE(filenameopt, machineopt)

Parameters:
NameTypeAttributesDefaultDescription
filenamestring<optional>

The name of the file.

machine'ieee-le' | 'ieee-be'<optional>
'ieee-le'

The byte order used by the machine ('ieee-le' for little-endian, 'ieee-be' for big-endian).

Methods

fclose()

Closes the file, clearing the content buffer and resetting the offset.

fopen(data)

Opens a data source and initializes the content buffer.

Parameters:
NameTypeDescription
dataArrayBuffer

The binary data to read from.

fread(number, typeopt) → {any}

Reads data from the file at the current offset.

Parameters:
NameTypeAttributesDefaultDescription
numbernumber

The number of items to read.

typestring<optional>
''

The data type to read (e.g., 'int32', 'float64', 'string', etc.). Defaults to 'uint8'.

Returns:

The read data, either as a single value or an array of values.

Type: 
any

frewind()

Resets the file pointer to the beginning of the file.

fseek(offset, origin)

Changes the current read/write position in the file.

Parameters:
NameTypeDescription
offsetnumber

The offset to move to.

originstring

The reference point for the offset ('bof' for beginning, 'cof' for current, 'eof' for end).

ftell() → {number}

Gets the current offset within the file.

Returns:

The current file offset.

Type: 
number