- Notifications
You must be signed in to change notification settings - Fork2
Module to make SteamID usage and conversion easy
License
node-steam/id
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ID is a module to makeSteamID usage and conversion easy using Typescript.
Heavily inspired bynode-steamid
(
<= v1.0.0
can be used as a drop-in replacement)
A SteamID is made up of four parts: it'sUniverse, it'sType, it'sInstance, and it'sAccount 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.
We provide aenum for all available 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 asCLAN
(Steam groups),GAMESERVER
, and more.We provide aenum for all available types
Instance: The instance ID isn't usually used.
We provide aenum for all available instances
Account ID: This represents a unique account of the persona
You can installID through the command line by using the following command:
yarn add @node-steam/id
import*asSteamIDfrom'@node-steam/id';// orimport{fromAccountID,ID,Instance,Type,Universe,}from'@node-steam/id';
You can create a SteamID object from a SteamID2, a SteamID3, a SteamID64, a Account ID or from the four parts that make up a SteamID:
constid=newID('STEAM_0:0:11101');
constid=newID('[U:1:22202]');
constid=newID('76561197960287930');
constid=newID();id.universe=Universe.PUBLIC;id.type=Type.INDIVIDUAL;id.instance=Instance.DESKTOP;id.accountid=22202;
constid=fromAccountID(22202);
API class
Check whether the ID is valid or not
constid=newID('76561197960287930');id.isValid();>true
Check whether the ID is tied to a steam groupchat or not
constid=newID('76561197960287930');id.isGroupChat();>false
Check whether the ID is a steam lobby or not
constid=newID('76561197960287930');id.isLobby();>false
Render the ID in the Steam2 format
Aliases:
get2, steam2, getSteam2RenderedID
constid=newID('76561197960287930');id.getSteamID2();>'STEAM_0:0:11101'
Render the ID in the Steam3 format
Aliases:
get3, steam3, getSteam3RenderedID
constid=newID('76561197960287930');id.getSteamID3();>'[U:1:22202]'
Render the ID in the 64-bit format
Aliases:
get64, steam64
constid=newID('STEAM_0:0:11101');id.getSteamID64();>'76561197960287930'
Create a ID object from an individual account ID
Aliases:
fromIndividualAccountID
constid=fromAccountID(22202);id.getSteamID64();>'76561197960287930'
Returns the Universe of the current ID
constid=newID('76561197960287930');id.getUniverse();>'PUBLIC'
Returns the Type of the current ID
constid=newID('76561197960287930');id.getType();>'INDIVIDUAL'
Returns the Instance of the current ID
constid=newID('76561197960287930');id.getInstance();>'DESKTOP'
Returns the Universe ID of the current ID
constid=newID('76561197960287930');id.getUniverseID();// orid.universe;>1
Returns the Type ID of the current ID
constid=newID('76561197960287930');id.getTypeID();// orid.type;>1
Returns the Instance ID of the current ID
constid=newID('76561197960287930');id.getInstanceID();// orid.instance;>1
Returns the Account ID of the current ID
constid=newID('76561197960287930');id.getAccountID();// orid.accountid;>22202
Returns the format that was used to generate the current ID
constid=newID('76561197960287930');id.getFormat();// orid.format;>'steam64'
Differences fromnode-steamid
- ES6 // Typescript syntax
- Typescript definitions
cuint
definitions- More
getters
- Modern ES6 tests
(Basically there is no real need to switch - the definitions were just needed for other related projects)
It is currently backward-compatible // works as drop-in replacement but the compatibility code will be removed in future versions!
- Silas Rech aka.lenovouser
Interested in contributing toID? Contributions are welcome, and are accepted via pull requests. Pleasereview these guidelines before submitting any pull requests.
Installing dependencies:
yarn
Compile:
yarn compile
Test:
yarn test
Generate Docs:
yarn docs
This module is thoroughly tested withava
About
Module to make SteamID usage and conversion easy