Garry's Mod Wiki

Revision Difference

file.Size#518420

<function name="Size" parent="file" type="libraryfunc"> <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&#x27;s name.</arg> <arg name="path" type="string">The path type.&#xA;&#xA;* &quot;GAME&quot; Structured like base folder (garrysmod/), searches all the mounted content (main folder, addons, mounted games etc)&#xA;* &quot;LUA&quot; or &quot;lsv&quot; - All Lua folders (lua/) including gamesmodes and addons&#xA;* &quot;DATA&quot; Data folder (garrysmod/data)&#xA;* &quot;MOD&quot; Strictly the game folder (garrysmod/), ignores mounting.</arg>⤶ <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>⤶ </args> </function> <example> <description>Prints the size of `helloworld.txt`.</description> <code>print( file.Size("helloworld.txt", "DATA") )</code> <output>8</output> </example>