Skip to content

Steam Utils

Utility functions and system information.

Methods

isSteamDeck()

Check if running on Steam Deck.

javascript
const isDeck = await steam.isSteamDeck();
if (isDeck) {
  // Adjust UI for Steam Deck
}

isSteamInBigPictureMode()

Check if Steam is in Big Picture Mode.

javascript
const isBigPicture = await steam.isSteamInBigPictureMode();

getServerRealTime()

Get Steam server time (Unix timestamp).

javascript
const timestamp = await steam.getServerRealTime();
const date = new Date(timestamp * 1000);

getIPCountry()

Get user's country code from IP.

javascript
const country = await steam.getIPCountry();
// 'US', 'DE', 'JP', etc.

getBuildId()

Get the app's build ID.

javascript
const buildId = await steam.getBuildId();

getCurrentGameLanguage()

Get the game's language setting.

javascript
const lang = await steam.getCurrentGameLanguage();
// 'english', 'german', 'japanese', etc.

getAvailableGameLanguages()

Get list of supported languages.

javascript
const languages = await steam.getAvailableGameLanguages();
// 'english,german,french,spanish'

DLC

getDLCCount()

Get number of DLCs.

javascript
const count = await steam.getDLCCount();

isDlcInstalled(appId)

Check if DLC is installed.

javascript
if (await steam.isDlcInstalled(12345)) {
  // Enable DLC content
}

isSubscribedApp(appId)

Check if user owns an app.

javascript
const ownsGame = await steam.isSubscribedApp(480);

isAppInstalled(appId)

Check if an app is installed.

javascript
const installed = await steam.isAppInstalled(480);

getAppInstallDir(appId)

Get installation directory of an app.

javascript
const dir = await steam.getAppInstallDir(480);

Workshop

getNumSubscribedItems()

Get number of subscribed workshop items.

javascript
const count = await steam.getNumSubscribedItems();

getSubscribedItems()

Get list of subscribed workshop item IDs.

javascript
const items = await steam.getSubscribedItems();
// Array of workshop item IDs

Examples

Steam Deck Optimization

javascript
async function initGame() {
  const isDeck = await steam.isSteamDeck();
  
  if (isDeck) {
    // Lower resolution for performance
    setResolution(1280, 800);
    // Larger UI elements
    setUIScale(1.5);
    // Controller-first input
    setInputMode('controller');
  }
}

Localization

javascript
async function loadLocalization() {
  const lang = await steam.getCurrentGameLanguage();
  
  const translations = await fetch(`lang/${lang}.json`);
  return translations.json();
}

DLC Content

javascript
const DLC_IDS = {
  soundtrack: 12345,
  expansion: 12346,
  skins: 12347
};

async function checkDLC() {
  const owned = {};
  
  for (const [name, id] of Object.entries(DLC_IDS)) {
    owned[name] = await steam.isDlcInstalled(id);
  }
  
  return owned;
}

async function loadContent() {
  const dlc = await checkDLC();
  
  if (dlc.expansion) {
    loadExpansionContent();
  }
  
  if (dlc.skins) {
    loadExtraSkins();
  }
}

Region-Based Features

javascript
async function initRegionalFeatures() {
  const country = await steam.getIPCountry();
  
  // Disable features in certain regions
  const restrictedCountries = ['CN', 'KR'];
  if (restrictedCountries.includes(country)) {
    disableOnlineFeatures();
  }
}