steamworks/Download

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Also menu state)
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Downloads a file from the supplied addon and saves it as a .cache file in garrysmod/cache folder.
+
|Description={{Deprecated|Use {{LibraryFunction|steamworks|DownloadUGC}} instead to download addons/content to use with {{LibraryFunction|game|MountGMA}}.}}
 +
 
 +
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.
 
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.
Line 7: Line 9:
 
|Realm=Client and Menu
 
|Realm=Client and Menu
 
|IsClass=No
 
|IsClass=No
|Name=Download
 
|Parent=steamworks
 
 
}}
 
}}
 
{{Arg
 
{{Arg

Latest revision as of 17:53, 20 January 2020

 steamworks.Download( )

Contents

Description

This feature is deprecated.
You should avoid using it as it may be removed in a future version.

Use steamworks.DownloadUGC instead to download addons/content to use with game.MountGMA.

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

string workshopPreviewID

The Preview ID of workshop item.

Arguments

boolean uncompress

Whether to uncompress the file or not, assuming it was compressed with LZMA.

You will usually want to set this to true.

Arguments

function resultCallback

The function to process retrieved data. The first and only argument is a string, containing path to the saved file.

Examples

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
Personal tools
Navigation