SteamID for Node.js
This module provides a SteamID object which makes SteamID usage and conversion easy.
Install it from npm:
$ npm install steamid
A SteamID is made up of four parts: its universe, its type, its instance, and its account ID.
- Universe: Currently, there are 5 universes. A universe is a unique instance of Steam. You'll probably only be interacting with the public universe, which is the regular Steam. Only Valve employees can access non-public universes.
- Type: A SteamID's type determines what it identifies. The most common type is individual, for user accounts. There are also other types such as clans (Steam groups), gameservers, and more.
- Instance: The instance ID isn't usually used.
- Account ID: This represents a unique account of a type.
There are enums for each type available under the root SteamID object.
SteamIDUniverse ="INVALID": 0"PUBLIC": 1"BETA": 2"INTERNAL": 3"DEV": 4;
SteamIDType ="INVALID": 0"INDIVIDUAL": 1"MULTISEAT": 2"GAMESERVER": 3"ANON_GAMESERVER": 4"PENDING": 5"CONTENT_SERVER": 6"CLAN": 7"CHAT": 8"P2P_SUPER_SEEDER": 9"ANON_USER": 10;
SteamIDInstance ="ALL": 0"DESKTOP": 1"CONSOLE": 2"WEB": 4;
You can create a SteamID object from a Steam2 rendered ID, a Steam3 rendered ID, a SteamID64, or from the four parts that make up a SteamID.
var SteamID = ;var sid = 'STEAM_0:0:23071901';
var SteamID = ;var sid = '[U:1:46143802]';
var SteamID = ;var sid = '76561198006409530';
var SteamID = ;var sid = ;siduniverse = SteamIDUniversePUBLIC;sidtype = SteamIDTypeINDIVIDUAL;sidinstance = SteamIDInstanceDESKTOP;sidaccountid = 46143802;
There's a shorthand method for creating an individual SteamID with the desktop instance in the public universe given an accountid:
var SteamID = ;var sid = SteamID;
Using a SteamID
Once you have created a
SteamID object, you can access its properties (
accountid) or you can convert it between rendered types.
true if the object represents a valid SteamID, or
false if not.
true if the
type of this SteamID is
CHAT, and it's associated with a Steam group's chat room.
true if the
type of thie SteamID is
CHAT, and it's associated with a Steam lobby.
Returns the Steam2 rendered ID format for individual accounts. Throws an error if the type isn't individual.
If you pass
newerFormat, the first digit will be 1 instead of 0 for the public universe.
var SteamID = ;var sid = '76561198006409530';console; // STEAM_0:0:23071901console; // STEAM_1:0:23071901
Returns the Steam3 rendered ID format.
var SteamID = ;var sid = '76561198006409530';console; // [U:1:46143802]var gid = '103582791434202956';console; // [g:1:4681548]
Returns the 64-bit representation of the SteamID.
var SteamID = ;var sid = '[g:1:4681548]';console; // 103582791434202956var sid2 = 'STEAM_0:0:23071901';console; // 76561198006409530
npm test to run the included test suite.