Volume

Represents a kOSProcessor hard disk or the archive.

structure Volume
Suffix Type Description
FREESPACE scalar Free space left on the volume
CAPACITY scalar Total space on the volume
NAME String Volume name
RENAMEABLE scalar True if the name can be changed
FILES Lexicon Lexicon of all files on the volume
POWERREQUIREMENT scalar Amount of power consumed when this volume is set as the current volume
EXISTS(filename) boolean Returns true if the given file exists
CREATE(filename) VolumeFile Creates a file
OPEN(filename) VolumeFile Opens a file
DELETE(filename) boolean Deletes a file
Volume:FREESPACE
Type:scalar
Access:Get only

Free space left on the volume

Volume:CAPACITY
Type:scalar
Access:Get only

Total space on the volume

Volume:NAME
Type:String
Access:Get only

Volume name. This name can be used instead of the volumeId with some file and volume-related commands

Volume:RENAMEABLE
Type:boolean
Access:Get only

True if the name of this volume can be changed. Currently only the name of the archive can’t be changed.

Volume:FILES
Type:Lexicon of VolumeFile
Access:Get only

List of files on this volume. Keys are the names of all files on this volume and values are the associated VolumeFile structures.

Volume:POWERREQUIREMENT
Type:scalar
Access:Get only

Amount of power consumed when this volume is set as the current volume

Volume:EXISTS(filename)
Returns:boolean

Returns true if the given file exists. This will also return true when the given file does not exist, but there is a file with the same name and .ks or .ksm extension added. Use Volume:FILES:HASKEY(filename) to perform a strict check.

Volume:OPEN(filename)
Returns:VolumeFile

Opens the file with the given name and returns VolumeFile. It will fail if the file doesn’t exist.

Volume:CREATE(filename)
Returns:VolumeFile

Creates a file with the given name and returns VolumeFile. It will fail if the file already exists.

Volume:DELETE(filename)
Returns:boolean

Deletes the given file. It will return true if file was successfully deleted and false otherwise.