Difference between revisions of "Fs.getSize"
From ComputerCraft Wiki
(Explain what this actually does, with reference to the forum post) |
(Change description and use type template) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=fs.getSize | |name=fs.getSize | ||
− | |args= | + | |args={{Type|string}} path |
− | |returns=bytes | + | |returns={{Type|int}} size in bytes |
|api=fs | |api=fs | ||
− | |desc=Gets the size of a file. This is not actually the exactly length of the file in bytes; rather, it is the amount that the file contributes towards the computer’s or disk’s storage quota. This is either 512 bytes or the actual length of the file plus the length of its name, whichever is larger.[http://www.computercraft.info/forums2/index.php?/topic/12243-152fsgetsize-returns-unexpected-values/] | + | |desc=Gets the size of a file in bytes. This is not actually the exactly length of the file in bytes; rather, it is the amount that the file contributes towards the computer’s or disk’s storage quota. This is either 512 bytes or the actual length of the file plus the length of its name, whichever is larger.[http://www.computercraft.info/forums2/index.php?/topic/12243-152fsgetsize-returns-unexpected-values/] |
|examples= | |examples= | ||
{{Example | {{Example |
Revision as of 19:43, 22 April 2013
Function fs.getSize | |
Gets the size of a file in bytes. This is not actually the exactly length of the file in bytes; rather, it is the amount that the file contributes towards the computer’s or disk’s storage quota. This is either 512 bytes or the actual length of the file plus the length of its name, whichever is larger.[1] | |
Syntax | fs.getSize(string path) |
Returns | int size in bytes |
Part of | ComputerCraft |
API | fs |
Examples
Example | |
Get the size of the shell from the ROM and print it | |
Code |
print( fs.getSize("/rom/programs/shell") ) |