Garry's Mod Wiki

Revision Difference

file.Size#528555

<function name="Size" parent="file" type="libraryfunc"> <description>Returns the file's size in bytes. If the file is not found, returns -1.</description> <description>Returns the file's size in bytes. If the file is not found, returns `-1`.</description> <realm>Shared and Menu</realm> <args> <arg name="fileName" type="string">The file's name.</arg> <arg name="path" type="string">The path type.⤶ * "GAME" Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)⤶ * "LUA" or "lsv" - All Lua folders (lua/) including gamesmodes and addons⤶ * "DATA" Data folder (garrysmod/data)⤶ * "MOD" Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ <arg name="gamePath" type="string">The path to look for the files and directories in. See <page text="this list">File_Search_Paths</page> for a list of valid paths.</arg>⤶ </args> </function> <example> <description>Prints the size of `helloworld.txt`.</description> <code>print( file.Size("helloworld.txt", "DATA") )</code> <output>8</output> ⤶ </example></example>