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

websteam

v1.0.1

Published

Node Steam Community

Downloads

7

Readme

node-websteam

npm package

Warning

Steam has banned bots before for buying and selling e.g. TF2 keys for a profit. I am not responsible if anything happens to your Steam account when using this. For support on a ban, do not contact me, instead contact the Steam Support.

Quick and easy

var WebSteam = require('websteam');
var MyUser = new WebSteam.User();
MyUser.Login("MyAccountName", "MyBase64EncryptedPassword", "GUARDCODE", function(err, code) {
  if(err) throw err;
  if(code === 0) {
    // You are already logged in!
  } else if(code === 1) {
    // You are now logged in
  } else if(code === 2) {
    // You need a SteamGuard code
  } else if(code === 3 || code === 4) {
    // Error
  }
});

WebSteam.User(options)

The user class, required for accessing everything else. Setting the DEBUG environment variable to SteamClass:User (See debug) you will be able to see all errors and debugging messages. No options are required. Options are:

  • CookieJar - A WebSteam.CookieJar object. Useful when loading cookies from a JSON file using CookieJar.fromJSON(string)
  • Username - The Steam Login name.
  • Currency - The currency integer;
    • 1 - USD
    • 2 - GBP
    • 3 - Euro

User.Login(Username, Password, SteamGuardCode, Callback)

Logs the user in using the given credentials.

  • Username is the username you use to login on Steam.
  • Password is the password, which has to be Base64 encoded.
  • SteamGuardCode is the Steam Guard code, which you receive in your inbox after a failed (code 2) login.
  • Callback(err, code) is the callback after the function is done logging in or has failed. Possible codes are:
    • 0 - You are already logged in, your cookie jar contains a session which is still valid.
    • 1 - You are now logged in.
    • 2 - Either your Steam Guard code is invalid, or you didn't give one but is required.
    • 3 - The login returned with a readable error message, check err.
    • 4 - An unknown error has shown up, check err.

User.GetSteamCommunityID(Callback)

Your Steam Community ID (steamcommunity.com/id/example) is not set after the Login, you need to call this before accessing User.SteamCommunityID.

  • Callback(err, id) is called when it has found the username or has failed to (err). If it can't find the ID, id returns 0.

User.GetSessionID()

Because, just like the Steam Community ID, User.SessionID is not set yet, you need to call this. This tries to retrieve the Session ID from the CookieJar. The function returns a bool, which is either true if it has successfully found it, or false if it failed to do so.

User.GetMissingCards(AppID, Callback)

Gets the missing cards for crafting a badge from the Game AppID.

  • AppID is the App ID which has to have the trading cards feature.
  • Callback(err, items) is called when it has found the required items or has failed. The items variable is an array that contains the item hashes of the missing cards.

User variables

  • User.CookieJar is a WebSteam.CookieJar.
  • User.rCookieJar is Request's version of the CookieJar (request.jar(User.CookieJar)).
  • User.Username is the user's login name.
  • User.SteamCommunityID is the Steam Community ID. This is empty until User.GetSteamCommunityID found it.
  • User.LoggedIn is true if the user is logged in, false otherwise.
  • User.PublicKeyMod is the Public Key Modulus, required for encrypting the password for logging in (SteamEncrypt.js).
  • User.PublicKeyExp is the Public Key Exponent, idem.
  • User.SessionID is the Session ID. See User.GetSessionID
  • User.Currency is the currency the account is using, see above for values. Defaults to 1 (USD).

WebSteam.MarketItem(options)

Class for using the market for things like checking items or creating buy orders. Setting the DEBUG environment variable to SteamClass:MarketItem (See debug) you will be able to see all errors and debugging messages. Options are:

  • ItemHash - The item's hash, can be found at the end of the item's url (e.g. steamcommunity.com/market/listings/753/4000-Invasion).
  • AppID - The App ID, can also be found in the url (e.g. steamcommunity.com/market/listings/753/4000-Invasion)
  • User - The User (WebSteam.User class) that sees the item.

MarketItem.GetPrice(Callback)

Finds the price and available amount of the item.

  • Callback(err, success) is called on success or failure. success is true on success.

MarketItem.Buy(Amount, Price, Callback)

Creates a buy order for the item.

  • Amount is the amount of items you want to buy at once.
  • Price is the price you pay for this item. Note: this is an integer, this means it cannot have decimals. For e.g. $2.19 use 219.
  • Callback(err, buyorderid) is called on success or failure. buyorderid is 0 if the buy order is not created.

MarketItem variables

  • MarketItem.SessionID is the SessionID, retrieved from WebSteam.User
  • MarketItem.AppID is the App ID (See options)
  • MarketItem.ItemHash is the Item hash (idem)
  • MarketItem.Price is the price after MarketItem.GetPrice ($2.19 becomes 219)
  • MarketItem.Amount is the amount of items available after MarketItem.GetPrice
  • MarketItem.Currency is the currency, see above.
  • MarketItem.User is the User class (WebSteam.User).