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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@unlomtrois/steampath

v1.0.3

Published

A library for searching steam installation paths

Downloads

29

Readme

steampath

TEST

CI

An elegant and lightweight Node.js library to locate the Steam installation directory across different operating systems: Windows, Linux, and macOS.

Features

  • Cross-Platform Support: Works seamlessly on Windows, Linux, and macOS.
  • Automatic Detection: Finds the Steam directory without any user configuration.
  • Handles Multiple Install Scenarios:
    • Standard installations
    • Flatpak and Snap installations on Linux
    • System-wide and user-specific installations on macOS
  • Asynchronous: Utilizes modern async/await syntax for non-blocking operations.

Installation

Install the package via npm:

npm install @unlomtrois/steampath

Usage

Import the library and use the locateSteamDir function to get the Steam directory path:

import { locateSteamDir } from "@unlomtrois/steampath";

(async () => {
    try {
        const steamDir = await locateSteamDir();
        console.log(`Steam is installed at: ${steamDir}`);
    } catch (error) {
        console.error(error.message);
    }
})();

Platform-Specific Functions

If you need to target a specific operating system, you can use the platform-specific functions:

  • Windows: locateSteamDirWindows()
  • Linux: locateSteamDirLinux()
  • macOS: locateSteamDirMacOS()
import { locateSteamDirWindows } from "@unlomtrois/steampath";

(async () => {
    try {
        const steamDir = await locateSteamDirWindows();
        console.log(`Steam is installed at: ${steamDir}`);
    } catch (error) {
        console.error(error.message);
    }
})();

API

locateSteamDir(): Promise<string>

Locates the Steam directory based on the current operating system.

  • Returns: A promise that resolves to the path of the Steam directory.
  • Throws: An error if the Steam directory is not found or the platform is unsupported.

locateSteamDirWindows(): Promise<string>

Locates the Steam directory on a Windows system.

  • Returns: A promise that resolves to the path of the Steam directory.
  • Throws: An error if the Steam directory is not found in the registry.

locateSteamDirLinux(): Promise<string>

Locates the Steam directory on a Linux system.

  • Returns: A promise that resolves to the path of the Steam directory.
  • Throws: An error if the Steam directory is not found.

locateSteamDirMacOS(): Promise<string>

Locates the Steam directory on a macOS system.

  • Returns: A promise that resolves to the path of the Steam directory.
  • Throws: An error if the Steam directory is not found.

Details

  • Windows Implementation:
    • Queries the Windows Registry to find the Steam installation path.
    • Supports both 32-bit and 64-bit registry hives.
  • Linux Implementation:
    • Checks multiple common installation paths, including standard, Flatpak, and Snap directories.
    • Uses parallel asynchronous checks for efficient detection.
  • macOS Implementation:
    • Looks for the Steam directory in the user's Library/Application Support folder.
    • Also checks the system-wide Library/Application Support directory.

Acknowledgements

This library was inspired by steamlocate-rs. Some concepts have been adapted from this Rust library to build a Node.js compatible solution.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.


Note: This library requires Node.js version 20 or higher to utilize the latest features and improvements in the fs module and asynchronous operations.