new FILE(filenameopt, machineopt)
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filename | string | <optional> | The name of the file. | |
machine | 'ieee-le' | | <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.
Name | Type | Description |
---|---|---|
data | ArrayBuffer | The binary data to read from. |
fread(number, typeopt) → {any}
Reads data from the file at the current offset.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
number | number | The number of items to read. | ||
type | string | <optional> | '' | The data type to read (e.g., 'int32', 'float64', 'string', etc.). Defaults to 'uint8'. |
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.
Name | Type | Description |
---|---|---|
offset | number | The offset to move to. |
origin | string | The reference point for the offset ('bof' for beginning, 'cof' for current, 'eof' for end). |
ftell() → {number}
Gets the current offset within the file.
The current file offset.
- Type:
- number