Garry's Mod Wiki

steamworks.Download

steamworks.Download( string workshopPreviewID, boolean uncompress, function resultCallback )

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.

In case the retrieved file is an image and you need the IMaterial, use AddonMaterial with the path supplied from the callback.

Arguments

1 string workshopPreviewID
The Preview ID of workshop item.
2 boolean uncompress
Whether to uncompress the file or not, assuming it was compressed with LZMA.
You will usually want to set this to true.
3 function resultCallback
The function to process retrieved data. The first and only argument is a string, containing path to the saved file.

Example

Downloads and saves icon of Gm_construct_Beta Steam Workshop addon.

steamworks.FileInfo( 21197, function( result ) steamworks.Download( result.previewid, true, function( name ) print( name ) end) end)
Output: Something like this will be printed into console: cache/559813303754221947.cache

Page Links


Special Pages


Wikis

?

Render Time: 42ms

DB GetPage 4
Generate Html 14
SaveChanges (1) 9
Render Body 0
Render Sidebar 12