From ComputerCraft Wiki
Revision as of 03:52, 18 August 2015 by Bomb Bloke (Behaviour change.)
|Gets the size of a file in bytes. Returns based on the contents of the file - if "file.txt" contains 29 bytes of data, then fs.getSize("file.txt") simply returns the number 29.|
Earlier versions of ComputerCraft returned the filesize plus the string length of the filename - for example, if "file.txt" contains 1000 bytes of data, then fs.getSize("file.txt") returns 1000 + #"file.txt" = 1008. Furthermore, if the value would be lower than 512, then 512 was returned instead. These behaviours were discarded somewhere between CC 1.53 and CC 1.57.
|Returns||number size in bytes|
|Get the size of the shell from the ROM and print it|
print( fs.getSize("/rom/programs/shell") )