npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

steam-game-path

v4.0.2

Published

Get installed Steam games and their library paths on Windows, Linux, and macOS with zero runtime dependencies.

Readme

Steam Game Path

Find installed Steam games and their library paths by app ID.

npm version CI Downloads License: MPL-2.0

Quick start · API reference · Supported platforms · Changelog

steam-game-path locates Steam, reads its library configuration, and checks game manifests for an installed game. Use it to find game files across the default installation and additional Steam libraries on Windows, Linux, and macOS.

Path lookups are synchronous and use local files. The package has zero runtime dependencies, including its own VDF parser.

Quick start

1. Install

Requires Node.js 22.12.0 or newer. The package uses ES modules and includes TypeScript declarations.

npm install steam-game-path

2. Find a game

Save as find-game.mjs:

import { getGamePath } from 'steam-game-path';

const result = getGamePath(730); // Steam app ID for Counter-Strike 2

if (result.success) {
	console.log(result.game.name);
	console.log('Game:', result.game.path);
	console.log('Steam:', result.steam.path);
} else {
	console.error('Lookup failed:', result.reason);
}
node find-game.mjs

A successful lookup returns an object like this. Game names and installation directory names come from the local manifest and may differ.

{
	success: true,
	game: {
		appId: 730,
		path: 'C:\\SteamLibrary\\steamapps\\common\\Counter-Strike Global Offensive',
		name: 'Counter-Strike 2'
	},
	steam: {
		path: 'C:\\Program Files (x86)\\Steam',
		libraries: [
			'C:\\SteamLibrary\\steamapps',
			'C:\\Program Files (x86)\\Steam\\steamapps'
		]
	},
	issues: []
}

API reference

| Function | Returns | Purpose | | :------------------------------- | :--------------------- | :------------------------------------------- | | getGamePath(appId, options?) | GamePathResult | Find one installed game. | | getGamePaths(appIds, options?) | GamePathResult[] | Find several games with one Steam discovery. | | getInstalledGames(options?) | InstalledGamesResult | List installed games across all libraries. | | getSteamPath() | string or null | Locate the Steam installation. | | getSteamLibraries(steamPath) | string[] or null | Read the configured library paths. |

Game lookups return { success: true, game, steam, issues } or { success: false, reason }. Check success before accessing the data; TypeScript narrows the exported result types automatically. Reasons include steam-not-found, game-not-found, and install-directory-missing. The API reference lists every reason and exported type.

[!IMPORTANT] getGamePath() now always returns an object. Replace old if (!result) or if (!result.game) checks with if (!result.success) and read result.reason on failure. Successful game objects also include appId.

Choose a Steam installation

All three game lookup functions accept { steamPath }. This selects an installation directly and bypasses automatic discovery, including Windows registry queries.

import { getGamePath } from 'steam-game-path';

const result = getGamePath(730, { steamPath: 'D:\\Steam' });

Supply the Steam installation directory, which contains steamapps. Relative paths are resolved against your application's working directory. An unavailable override returns steam-not-found; it does not fall back to another installation.

Find several games

import { getGamePaths } from 'steam-game-path';

const appIds = [730, 440, 570];
const results = getGamePaths(appIds);

for (const [index, result] of results.entries()) {
	if (result.success) console.log(result.game.appId, result.game.path);
	else console.log(appIds[index], result.reason);
}

Results follow the input order, including duplicates. Steam discovery and library configuration are shared across the batch, and repeated app IDs are searched once. An empty input returns [] without accessing Steam.

List installed games

import { getInstalledGames } from 'steam-game-path';

const result = getInstalledGames();

if (result.success) {
	console.table(result.games); // { appId, name, path } entries, sorted by app ID
	for (const issue of result.issues) console.warn(issue.code, issue.path);
} else {
	console.error('Could not scan Steam:', result.reason);
}

Games are deduplicated by app ID; the first valid copy in library order wins. Broken manifests and unavailable libraries are reported in issues while valid games are retained. An empty issues array means no problems were encountered; an empty games array can be a successful scan of an empty installation.

Find Steam and its libraries

import { getSteamPath, getSteamLibraries } from 'steam-game-path';

const steamPath = getSteamPath();

if (steamPath) {
	const libraries = getSteamLibraries(steamPath);
	console.log('Steam:', steamPath);
	console.log('Configured libraries:', libraries);
}

Pass the Steam installation directory to getSteamLibraries, rather than its steamapps subdirectory. It supports both legacy string entries and modern object entries in libraryfolders.vdf.

This helper returns the configured paths without deduplicating them or adding the default library. It returns null when the configuration is missing, unreadable, malformed, or has no library section; an empty section returns [].

Need executable metadata?

[!WARNING] Executable metadata lookup has been removed from this package to avoid installing the large steam-user dependency tree for an optional feature. Use getGamePath(appId) for the installation directory. The previous getGamePath(appId, true) call and game.executable are no longer supported.

If you need launch metadata, install steam-user in your application and query it separately:

npm install steam-user
import SteamUser from 'steam-user';

function getLaunchMetadata(appId) {
	return new Promise((resolve, reject) => {
		const client = new SteamUser({ autoRelogin: false });
		let settled = false;
		const timeout = setTimeout(() => finish(new Error('Steam lookup timed out')), 10_000);

		function finish(error, launches = null) {
			if (settled) return;
			settled = true;
			clearTimeout(timeout);
			client.logOff();
			if (error) reject(error);
			else resolve(launches);
		}

		client.on('error', error => finish(error));
		client.once('loggedOn', async () => {
			if (settled) return;
			try {
				const { apps } = await client.getProductInfo([appId], []);
				const launches = apps[appId]?.appinfo?.config?.launch;
				finish(null, launches ? Object.values(launches) : null);
			} catch (error) {
				finish(error);
			}
		});

		try {
			client.logOn({ anonymous: true });
		} catch (error) {
			finish(error);
		}
	});
}

try {
	console.log(await getLaunchMetadata(730));
} catch (error) {
	console.error('Could not retrieve launch metadata:', error);
}

This standalone example connects to Steam anonymously and requires internet access. It returns launch configuration entries, or null when none are available. Entries can describe multiple platforms and launch modes; they are not resolved absolute executable paths. See the steam-user API for details.

Supported platforms

| Platform | Steam location checked | | :------- | :---------------------------------------------------------------------------------------- | | Windows | Registry: machine InstallPath, then current-user SteamPath; 32-bit and 64-bit views | | Linux | ~/.steam/root, then ~/.var/app/com.valvesoftware.Steam/.local/share/Steam for Flatpak | | macOS | ~/Library/Application Support/Steam |

Windows registry lookup calls the built-in reg.exe directly through Node.js, with no native addon or bundled executable. It checks both registry views with a shared 5-second timeout budget. Non-ASCII paths depend on the Windows command's output encoding. See Windows registry implementation for details.

getSteamPath returns null when Steam cannot be located through these checks. It throws on unsupported operating systems. The game lookup functions return unsupported-platform instead, and an explicit steamPath bypasses platform discovery. Filesystem failures are reported through reason or issues; invalid arguments throw TypeError.

Development

npm ci
npm run typecheck
npm test
npm run build

License

Copyright (c) 2019–2026 Hubert Walczak and contributors.

Mozilla Public License 2.0