Garry's Mod Wiki

steamworks.DownloadUGC

  steamworks.DownloadUGC( string workshopID, function resultCallback )

Description

A serverside implementation of this function can be provided by binary modules, such as gmsv_workshop.

Downloads a Steam Workshop file by its ID and returns a path to it.

Arguments

1 string workshopID
The ID of workshop item to download. NOT a file ID.
2 function resultCallback
The function to process retrieved data.
Function argument(s):
1 string path - Contains a path to the saved file, or nil if the download failed for any reason.
2 file_class file - A file object pointing to the downloaded .gma file. The file handle will be closed after the function exits.

Example

Downloads the Fire Extinguisher addon from Steam Workshop prints path to its .gma file to be used with game.MountGMA.

steamworks.DownloadUGC( "104607228", function( path, file ) print( path, file ) end)