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

steamid-ts

v0.1.0

Published

Parse, validate, and convert Steam IDs and Steam trade offer URLs.

Readme

steamid-ts

steamid-ts is a small TypeScript library for parsing, validating, and converting Steam identifiers. It works in Node.js and modern browsers, has no runtime dependencies, and includes first-class support for Steam trade offer URLs.

Features

  • Parse SteamID64, Steam2, Steam3, numeric profile URLs, invite URLs, and trade offer URLs.
  • Convert between SteamID64, Steam2, Steam3, and account IDs.
  • Extract trade URL data, including the partner account ID, derived SteamID64, trade token, and extra query parameters.
  • Resolve vanity URLs through a caller-provided resolver, so API keys stay on your backend.
  • Ship ESM, CommonJS, and TypeScript declaration builds.

Installation

npm install steamid-ts

Quick Start

import { SteamID } from 'steamid-ts';

const steamID = new SteamID('76561197984981409');

const steam3 = steamID.toSteam3();
const steam2 = steamID.toSteam2();
const uint64 = steamID.toUInt64();

Results:

| Value | Output | | -------- | -------------------- | | steam3 | [U:1:24715681] | | steam2 | STEAM_1:1:12357840 | | uint64 | 76561197984981409 |

Supported Inputs

new SteamID('76561197984981409');
new SteamID('STEAM_0:1:4491990');
new SteamID('[U:1:24715681]');
new SteamID('[g:1:4145017]');

URLs that contain enough information locally can also be parsed without a backend lookup:

const resolver = () => null;

SteamID.fromURL(
  'https://steamcommunity.com/profiles/76561197984981409',
  resolver,
);
SteamID.fromURL('https://s.team/p/qpn-pmn', resolver);
SteamID.fromURL(
  'https://steamcommunity.com/tradeoffer/new/?partner=177628825&token=RTL-Qm-w',
  resolver,
);

Trade URLs

Trade offer URLs encode the partner query parameter as the Steam account ID from Steam3 format. For example, partner=177628825 maps to [U:1:177628825] and 76561198137894553.

Use fromTradeURL when you need the trade token or other query parameters:

import { SteamID } from 'steamid-ts';

const trade = SteamID.fromTradeURL(
  'https://steamcommunity.com/tradeoffer/new/?partner=177628825&token=RTL-Qm-w',
);

const accountID = trade.accountID;
const steam3 = trade.steamID.toSteam3();
const steamID64 = trade.steamID.toUInt64();
const token = trade.token;

Results:

| Value | Output | | ----------- | ------------------- | | accountID | 177628825 | | steam3 | [U:1:177628825] | | steamID64 | 76561198137894553 | | token | RTL-Qm-w |

fromURL also accepts trade URLs and returns the derived SteamID directly.

Vanity URLs

Steam vanity URLs, such as https://steamcommunity.com/id/xpaw, do not contain a numeric SteamID. They need a resolver function:

import { SteamID, VanityType, type VanityResolver } from 'steamid-ts';

const resolver: VanityResolver = (id, type) => {
  if (id === 'xpaw' && type === VanityType.Individual) {
    return '76561197972494985';
  }

  return null;
};

const steamID = SteamID.fromURL(
  'https://steamcommunity.com/id/xpaw/',
  resolver,
);

Use fromURLAsync if the resolver calls your backend:

const steamID = await SteamID.fromURLAsync(
  'https://steamcommunity.com/id/xpaw/',
  async (id, type) => {
    const response = await fetch(`/api/steam/resolve?id=${id}&type=${type}`);
    const data = (await response.json()) as { steamID: string | null };
    return data.steamID;
  },
);

API

new SteamID(value?)

Creates a SteamID from a SteamID64 string, Steam2 string, Steam3 string, number, or bigint.

Instance Methods

  • isValid()
  • toSteam2()
  • toSteam3()
  • toSteamInvite()
  • toUInt64()
  • toString()
  • setFromUInt64(value)
  • getAccountID()
  • getAccountInstance()
  • getAccountType()
  • getAccountUniverse()
  • setAccountID(value)
  • setAccountInstance(value)
  • setAccountType(value)
  • setAccountUniverse(value)

Static Methods

  • SteamID.fromAccountID(accountID)
  • SteamID.accountIDToUInt64(accountID)
  • SteamID.renderAccountID(accountID)
  • SteamID.fromURL(value, resolver)
  • SteamID.fromURLAsync(value, resolver)
  • SteamID.fromTradeURL(value)

Validation

Invalid input throws SteamIDError. The parser rejects unsafe or ambiguous inputs such as whitespace-padded IDs, newline-terminated IDs, Unicode digits, null bytes, and overflowing values.

Development

npm install
npm test
npm run coverage
npm run typecheck
npm run lint
npm run build

Acknowledgements

This project is a from-scratch TypeScript implementation informed by the behavior of the MIT-licensed xPaw/SteamID.php library.

License

MIT