JSPM

@ciberus/find-steam-app

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q51646F
  • License MIT

Find location of an installed Steam app

Package Exports

  • @ciberus/find-steam-app
  • @ciberus/find-steam-app/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ciberus/find-steam-app) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ciberus/find-steam-app

Find steam location on disk, installed steam apps and libraries

Rewrite of original find-steam-app with improved types, written tests, new functions like findSteam and fixed edge cases with multiple "steam libraries". If you find it helpful please star it on github

Install

npm i @ciberus/find-steam-app -S

Support

  • windows ✅
  • osx - ✅
  • linux - ⚠️not tested

Usage

import {
  IAppManifest,
  ISteamLibraries,
  ISteamLibrariesRaw,
  findSteamPath,
  findSteamAppById,
  findSteamAppByName,
  findSteamAppManifest,
  findSteamLibraries,
  getLibraryManifestsFolder,
  getLibraryInstallsFolder,
} from "find-steam-app";

const steamLibs: ISteamLibraries = await findSteam();
// => {
//      version: "v2",
//      steamPath: "C:/Program Files (x86)/Steam",
//      librariesVdfFilePath: "C:/Program Files (x86)/Steam/steamapps/libraryfolders.vdf"
//      libraries: [{
//           path: "F:/SteamLibrary",
//           apps: [{
//             appId: 570,
//             path: "F:/SteamLibrary/steamapps/common/dota 2 beta",
//             manifestPath: "F:/SteamLibrary/steamapps/appmanifest_570.acf"
//             manifest: {
//                appid: 570,
//                installdir: "dota 2 beta"
//                buildid: 8651789
//                ...
//             }
//          }]
//      }]
//    }

await findSteamPath();
// => 'C:/Program Files (x86)/Steam'

await findSteamAppById(570);
// => 'F:/SteamLibrary/steamapps/common/dota 2 beta'

await findSteamAppByName("dota 2 beta");
// => 'F:/SteamLibrary/steamapps/common/dota 2 beta'

const res: IAppManifest = await findSteamAppManifest(570);
// => { appid: 570, Universe: 1, name: 'Dota 2', ... }

const libs: string[] = await findSteamLibrariesPaths();
// => ['C:/Program Files (x86)/Steam', 'F:/SteamLibrary', ...]

// can be transformed like this
libs.map(getLibraryManifestsFolder);
// => ['C:/Program Files (x86)/Steam/steamapps', 'F:/SteamLibrary/steamapps']
libs.map(getLibraryInstallsFolder);
// => ['C:/Program Files (x86)/Steam/steamapps/common', 'F:/SteamLibrary/steamapps/common', ...]

const steamLibsRaw: ISteamLibrariesRaw = await findSteamLibraries();
// => [{ path: 'F:/SteamLibrary', totalsize: 41234, apps: ['570'], ... }, ...]

AppManifest - manifest.ts

How it works

Steam has "Libraries" - locations on disks there games installed, "Libraries" has 2 versions, most users use v2, but this package support v1 also

  • v1 - contain only path to library, we can identify where app installed only indirectly by searching apps manifests appmanifest_%appId%.acf in Steam Libraries
  • v2 - contains complete info about library and apps inside it, that gives opportunity to detect where app installed exactly

Tests

  • __data__ contain the files that will be used to mock the filesystem.
  • __data__ mimic the filesystem of the computer.
  • so if u know any edge cases, u can try to add those files and see tests are pass if not pls open issue

Edge cases

  1. after uninstall app folder like "dota 2 beta" in "common" still exist
  2. after moving app folder in another library manifest still exists in old library but became encrypted and *.acf.tmp.save manifest created near
  3. dota 2 was installed on disk D, moved on disk F, and somehow in library on disk E in /common folder dota 2 beta folder exist
  • disk D
    • has appmanifest_570.acf
    • has appmanifest_570.acf.tmp.save
    • no folder dota 2 beta in /common
  • disk E
    • no manifest
    • has folder dota 2 beta in /common
  • disk F - right disk
    • has appmanifest_570.acf
    • dont have appmanifest *.acf.tmp.save
    • has folder dota 2 beta in /common
  1. manifest exists but game folder - not
  2. manifest exists but game moved in another library and cant read manifest
  3. manifest exists but game moved in another library, we can only compare size of games and choose heavier one

TODO

  • jsdoc/tsdoc
  • better edge cases description