A Node.js script that extracts Steam Workshop addon IDs from a Steam collection and outputs them in a format that can be used for Garry's Mod servers.
The script:
- Connects to the Steam API
- Downloads the details of a Steam collection
- Extracts all workshop IDs from the collection
- Generates an
addons.txtfile withresource.AddWorkshop()commands
- Make sure Node.js is installed
- Install the dependencies:
npm install- Open
script.jsin a text editor - Replace
"collection-id-here"with the actual Steam collection ID - Run the script:
node script.jsYou can find the collection ID in the URL of a Steam collection:
https://steamcommunity.com/sharedfiles/filedetails/?id=123456789
In this example, 123456789 would be the collection ID.
The script creates an addons.txt file with the following format:
resource.AddWorkshop(106404821)
resource.AddWorkshop(110656185)
resource.AddWorkshop(118623480)
...
This file can be used directly in your Garry's Mod server.
- axios: For HTTP requests to the Steam API
- fs: Node.js built-in filesystem module
The script handles download errors and displays appropriate error messages.
After running the script with a valid collection ID, you'll get output like:
Ready! 492 Addons saved in addons.txt.
The generated addons.txt file contains all workshop IDs from the collection in the correct format for Garry's Mod.