Revision Difference
steamworks.Download#561375
<function name="Download" parent="steamworks" type="libraryfunc">
<description>
Downloads a file from the supplied addon and saves it as a .cache file in garrysmod/cache folder.⤶
⤶
This is mostly used to download the preview image of the addon, but the game seems to also use it to download replays and saves.
<note>You really should be using <page>steamworks.DownloadUGC</page>. This is a legacy function.</note>⤶
⤶
Downloads a file from the supplied addon and saves it as a `.cache` file in `garrysmod/cache/` folder.
⤶
This is mostly used to download the preview image of the addon.⤶
In case the retrieved file is an image and you need the <page>IMaterial</page>, use <page>Global.AddonMaterial</page> with the path supplied from the callback.
</description>
<realm>Client and Menu</realm>
<args>
<arg name="workshopPreviewID" type="string">The Preview ID of workshop item.</arg>
<arg name="uncompress" type="boolean">Whether to uncompress the file or not, assuming it was compressed with LZMA.<br/>
You will usually want to set this to true.</arg>
<arg name="resultCallback" type="function">The function to process retrieved data. The first and only argument is a string, containing path to the saved file.</arg>⤶
<arg name="resultCallback" type="function">The function to process retrieved data.⤶
⤶
<callback>⤶
<arg type="string" name="path">Path to the downloaded file.</arg>⤶
</callback>⤶
</arg>⤶
</args>
</function>
<example>
<description>Downloads and saves icon of Gm_construct_Beta Steam Workshop addon.</description>
<code>
steamworks.FileInfo( 21197, function( result )
steamworks.Download( result.previewid, true, function( name )
print( name )
end)
end)
</code>
<output>Something like this will be printed into console: cache/559813303754221947.cache</output>
</example>