{"id":13821904,"url":"https://github.com/Step7750/node-csgo-cdn","last_synced_at":"2025-05-16T15:31:29.774Z","repository":{"id":27535172,"uuid":"114161401","full_name":"Step7750/node-csgo-cdn","owner":"Step7750","description":"Retrieves the Steam CDN Image URLs for CS:GO Items","archived":false,"fork":false,"pushed_at":"2024-01-10T08:09:32.000Z","size":175,"stargazers_count":73,"open_issues_count":5,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-12T20:03:42.420Z","etag":null,"topics":["cdn","csgo","csgo-cdn","nodejs","stickers","vdf","vpk"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Step7750.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-13T19:37:15.000Z","updated_at":"2024-05-18T01:13:12.000Z","dependencies_parsed_at":"2023-01-14T06:57:50.617Z","dependency_job_id":"6d1de365-497c-4352-9092-9539cf5ede6f","html_url":"https://github.com/Step7750/node-csgo-cdn","commit_stats":{"total_commits":92,"total_committers":9,"mean_commits":"10.222222222222221","dds":"0.21739130434782605","last_synced_commit":"44955ca03ada6c30612c2f3daf7b4da61ec052bf"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Step7750%2Fnode-csgo-cdn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Step7750%2Fnode-csgo-cdn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Step7750%2Fnode-csgo-cdn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Step7750%2Fnode-csgo-cdn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Step7750","download_url":"https://codeload.github.com/Step7750/node-csgo-cdn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225424398,"owners_count":17472303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdn","csgo","csgo-cdn","nodejs","stickers","vdf","vpk"],"created_at":"2024-08-04T08:01:33.283Z","updated_at":"2024-11-19T22:31:16.492Z","avatar_url":"https://github.com/Step7750.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# node-csgo-cdn\n\nRetrieves the Steam CDN URLs for CS:GO Item Images from their `market_hash_name` or properties.\n\nCan retrieve CDN images for:\n* Stickers\n* Characters\n* Graffiti (without tint)\n* Weapons (and doppler phases)\n* Music Kits\n* Tools (Crate Keys, Cases, Stattrak Swap Tool, etc...)\n* Status Icons (Pins, ESports Trophies, Map Contribution Tokens, Service Medals, etc...)\n\n\n## Table of Contents\n  * [Why?](https://github.com/Step7750/node-csgo-cdn#why)\n  * [How?](https://github.com/Step7750/node-csgo-cdn#how)\n  * [How to Install](https://github.com/Step7750/node-csgo-cdn#how-to-install)\n  * [Methods](https://github.com/Step7750/node-csgo-cdn#methods)\n    * [Constructor(client, options)](https://github.com/Step7750/node-csgo-cdn#constructorclient-options)\n    * [getItemNameURL(marketHashName, phase)](https://github.com/Step7750/node-csgo-cdn#getitemnameurlmarkethashname-phase)\n    * [getStickerURL(stickerName, large=true)](https://github.com/Step7750/node-csgo-cdn#getstickerurlstickername-largetrue)\n    * [getWeaponURL(defindex, paintindex)](https://github.com/Step7750/node-csgo-cdn#getweaponurldefindex-paintindex)\n  * [Properties](https://github.com/Step7750/node-csgo-cdn#properties)\n    * [itemsGame](https://github.com/Step7750/node-csgo-cdn#itemsgame)\n    * [csgoEnglish](https://github.com/Step7750/node-csgo-cdn#csgoenglish)\n    * [itemsGameCDN](https://github.com/Step7750/node-csgo-cdn#itemsgamecdn)\n    * [phase](https://github.com/Step7750/node-csgo-cdn#phase)\n  * [Events](https://github.com/Step7750/node-csgo-cdn#events)\n    * [ready](https://github.com/Step7750/node-csgo-cdn#ready)\n    \n\n## Why?\n\nSteam hosts all of the CS:GO resource images on their CDN, but unfortunately finding the URL for them was\ndifficult in the past and would require scraping the market or inventories.\n\nThis library allows you to retrieve the needed CDN URLs given the sticker name, which can save you lots in bandwidth\nand prevents you from having to scrape it or host it yourself.\n\n\n## How?\n\nMost of the graphical resources for CSGO are stored in [VPK](https://developer.valvesoftware.com/wiki/VPK_File_Format)\nfiles which include the sticker, music kit, tools, and status icon images.\n\nThe root of a VPK contains a `dir` file (`pak01_dir.vpk`) that specifies where files are located over multiple packages. If you look in\nthe install directory of CS:GO, you'll see `pak01_003.vpk`, `pak01_004.vpk`, etc... where these files are located.\n\nThankfully, Valve was kind enough (as of writing this) to include all of the relevant images in a few packages\nwhich are only ~400MB.\n\nThis library, using node-steam-user, checks the manifest for any updates to the public branch of CS:GO, and if so,\ndownloads only the required VPK packages that contain all relevant images if they have changed from the\ncontent servers.\n\nWhen trying to retrieve a CDN image URL for a given item, the library takes the SHA1 hash of the file and the VPK\npath that links to it to generate the corresponding URL.\n\nExample URL: https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/cologne2015/mousesports.3e75da497d9f75fa56f463c22db25f29992561ce.png\n\n## How to Install\n\n### `npm install csgo-cdn`\n\n#### See example.js\n```javascript\nconst SteamUser = require('steam-user');\nconst csgoCDN = require('csgo-cdn');\n\nconst user = new SteamUser();\nconst cdn = new csgoCDN(user, {logLevel: 'debug'});\n\ncdn.on('ready', () =\u003e {\n   console.log(cdn.getItemNameURL('M4A4 | 龍王 (Dragon King) (Field-Tested)'));\n   console.log(cdn.getItemNameURL('★ Karambit | Gamma Doppler (Factory New)', cdn.phase.emerald));\n});\n```\n\n## Methods\n\n### Constructor(client, options)\n\n* `client` - [node-steam-user](https://github.com/DoctorMcKay/node-steam-user) Client **The account MUST own CS:GO**\n* `options` - Options\n    ```javascript\n    {\n        directory: 'data', // relative data directory for VPK files\n        updateInterval: 30000, // seconds between update checks, -1 to disable auto-updates\n        logLevel: 'info', // logging level, (error, warn, info, verbose, debug, silly)\n        stickers: true, // whether to obtain the vpk for stickers\n        patches: true, // whether to obtain the vpk for patches\n        graffiti: true, // whether to obtain the vpk for graffiti\n        musicKits: true, // whether to obtain the vpk for music kits\n        cases: true, // whether to obtain the vpk for cases\n        tools: true, // whether to obtain the vpk for tools\n        statusIcons: true, // whether to obtain the vpk for status icons\n    }\n    ```\n    \n### getItemNameURL(marketHashName, phase)\n\n* `marketHashName` - The market hash name of an item (ex. \"Sticker | Robo\" or \"AWP | Redline (Field-Tested)\")\n* `phase` - Optional weapon phase for doppler skins from the `phase` enum property\n\n**Note: If the item is a weapon, you can omit the wear (ex. `AWP | Redline`)**\n\nEnsure that you have enabled the relevant VPK downloading for the item category by using the options in the constructor.\n\nReturns the 'large' version of the image.\n\n### getStickerURL(stickerName, large=true)\n\n* `stickerName` - Name of the sticker path from `items_game.txt` (ex. cluj2015/sig_olofmeister_gold)\n* `large` - Whether to obtain the large version of the image\n\n### getPatchURL(patchName, large=true)\n\n* `stickerName` - Name of the patch path from `items_game.txt` (ex. case01/patch_phoenix)\n* `large` - Whether to obtain the large version of the image\n\n\n### getWeaponURL(defindex, paintindex)\n\n* `defindex` - Definition index of the item (ex. 7 for AK-47)\n* `paintindex` - Paint index of the item (ex. 490 for Frontside Misty)\n\n## Properties\n\n### itemsGame\n\nParsed items_game.txt file as a dictionary\n\n### csgoEnglish\n\nParsed csgo_english file as a dictionary. Also contains all inverted keys, such that the values are also keys themselves\nfor O(1) retrieval.\n\n### itemsGameCDN\n\nParsed items_game_cdn.txt file as a dictionary\n\n### phase\n\nDoppler phase enum used to specify the phase of a knife\n\n```javascript\ncdn.getItemNameURL('★ Karambit | Gamma Doppler (Factory New)', cdn.phase.emerald);\ncdn.getItemNameURL('★ Huntsman Knife | Doppler (Factory New)', cdn.phase.blackpearl);\ncdn.getItemNameURL('★ Huntsman Knife | Doppler (Factory New)', cdn.phase.phase1);\ncdn.getItemNameURL('★ Flip Knife | Doppler (Minimal Wear)', cdn.phase.ruby);\ncdn.getItemNameURL('★ Flip Knife | Doppler (Minimal Wear)', cdn.phase.sapphire);\n```\n\n## Events\n\n### ready\n\nEmitted when csgo-cdn is ready, this must be emitted before using the object\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStep7750%2Fnode-csgo-cdn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStep7750%2Fnode-csgo-cdn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStep7750%2Fnode-csgo-cdn/lists"}