File-IO functions.
Members
# inner FILE
file mode definition.
Properties:
Name | Type | Description |
---|---|---|
READ |
*
|
open file in read mode. |
WRITE |
*
|
open file in write mode (truncating existing contents) |
APPEND |
*
|
open file in append mode. |
# inner ZIPFILE
ZIP file mode definition.
Properties:
Name | Type | Description |
---|---|---|
READ |
*
|
open ZIP file in read mode. |
WRITE |
*
|
open ZIP file in write mode (truncating existing contents) |
APPEND |
*
|
open ZIP file in append mode. |
DELETE |
*
|
open ZIP file in delete mode. |
Methods
# inner BytesToString(data) → {string}
Convert byte array to ASCII string. The string is terminated at the first NULL byte or at array length (whichever comes first).
Parameters:
Name | Type | Description |
---|---|---|
data |
Array.<number>
|
array of numbers. |
a string.
string
# inner FreeSpace(drvNum) → {FreeInfo}
Get free space info on drive.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
drive space info object.
# inner GetFSType(drvNum) → {string}
determine file system type.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
file system type.
string
# inner GetParallelPorts() → {Array.<number>}
get available parallel ports.
list of available parallel ports and their addresses.
Array.<number>
# inner GetSerialPorts() → {Array.<number>}
get available serial ports.
list of available serial ports and their addresses.
Array.<number>
# inner IsCDROM(drvNum) → {boolean}
Check if drive is a CD-ROM.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
true if this is a CD-ROM, else false.
boolean
# inner IsFAT32(drvNum) → {boolean}
Check if drive was formated with FAT32.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
true if this is a FAT32 volume, else false.
boolean
# inner IsFixed(drvNum) → {boolean}
Check if drive is a fixed drive.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
true if this is a fixed drive, else false.
boolean
# inner IsRAMDisk(drvNum) → {boolean}
Check if drive is a RAM disk.
Parameters:
Name | Type | Description |
---|---|---|
drvNum |
number
|
Number of the drive (0=default, 1=A:, 2 == B:, etc). |
true if this is a RAM disk, else false.
boolean
# inner List(dname) → {Array.<string>}
Get directory listing.
Parameters:
Name | Type | Description |
---|---|---|
dname |
string
|
name of directory to list. |
Throws an error if listing fails.
array of entry names.
Array.<string>
# inner Makedir(name)
Create a directory.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
name of new directory. |
Will throw an error if the directory could not be created.
# inner NamedFunction(p, s, fopt)
parse a string into a function. Works like Function() by a source file name can be provided.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
p |
string
|
name of the single parameter. | |
s |
string
|
the source of the function. | |
f |
string
|
<optional> |
an optional filename where the source came from. |
# inner Read(filename) → {string}
Load the contents of a file into a string. Throws exception if loading fails.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string
|
name of file to read. |
Throws an error if reading fails.
the contents of the file.
string
# inner ReadZIP(filename, entryname) → {string}
Load the contents of a ZIP file entry into a string. Throws exception if loading fails.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string
|
name of file to read. |
entryname |
string
|
name of entry in the ZIP file to read. |
Throws an error if reading fails.
the contents of the file.
string
# inner Rename(from, to)
Rename file or directory.
Parameters:
Name | Type | Description |
---|---|---|
from |
string
|
old name. |
to |
string
|
new name. |
Throws an error if renaming fails.
# inner RmDir(name)
Remove a directory. The directory must be empty.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
name of the directory. |
Throws an error if the directory could not be removed.
# inner RmFile(name)
Remove a file.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
name of the file. |
Throws an error if the file could not be removed.
# inner Sleep(s)
Sleep for the given number of s.
Parameters:
Name | Type | Description |
---|---|---|
s |
number
|
time to sleep. |
# inner Stat(name) → {StatInfo}
Get information about a file / directory.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
name of the file to get info for. |
Throws an error if stat fails.
an info object.
# inner StringToBytes(str) → {Array.<number>}
Convert ASCII string to byte array.
Parameters:
Name | Type | Description |
---|---|---|
str |
string
|
string to convert. |
array of numbers.
Array.<number>