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

node-steam-api

v1.0.1

Published

Node Client wrapper for Steam API

Downloads

25

Readme

Get Started

Installation

npm install node-steam-api

Create Steam API web key

Steam API Web key

Follow instructions to get API Key

Create .env file

From root of your project

touch .env

echo "STEAM_API_KEY=<YOUR_STEAM_API KEY>" >> .env

Basic Usage

Getting User details by steam id

require("dotenv").config();

const Steam = require("node-steam-api");
const key = process.env.STEAM_API_KEY;
const steam = new Steam(key);

const getUserDetail = async () => {
  // argument: steamId
  return await steam.users.getUserDetails("76561198995017863");
};

Response

{
  player: {
    steamid: '76561198995017863',
    communityvisibilitystate: 3,
    profilestate: 1,
    personaname: 'The12thChairman',
    profileurl: 'https://steamcommunity.com/id/the12thchairman/',
    avatar: 'https://avatars.steamstatic.com/427ef7d5f8ad7b21678f69bc8afc95786cf38fe6.jpg',
    avatarmedium: 'https://avatars.steamstatic.com/427ef7d5f8ad7b21678f69bc8afc95786cf38fe6_medium.jpg',
    avatarfull: 'https://avatars.steamstatic.com/427ef7d5f8ad7b21678f69bc8afc95786cf38fe6_full.jpg',
    avatarhash: '427ef7d5f8ad7b21678f69bc8afc95786cf38fe6',
    lastlogoff: 1681014493,
    personastate: 0,
    primaryclanid: '103582791429521408',
    timecreated: 1570311509,
    personastateflags: 0,
    loccountrycode: 'US'
  }
}

Getting Friends List

require("dotenv").config();

const Steam = require("node-steam-api");
const key = process.env.STEAM_API_KEY;
const steam = new Steam(key);

const STEAM_ID = "76561198995017863";
const getUserFriendsList = async () => {
  // argument: steamId
  return await steam.users.getUserFriendsList(STEAM_ID);
};

getUserFriendsList();

Response

{
  friends: [
    {
      steamid: "76561198030124562",
      communityvisibilitystate: 3,
      profilestate: 1,
      personaname: "Robz",
      profileurl: "https://steamcommunity.com/profiles/76561198030124562/",
      avatar:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg",
      avatarmedium:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_medium.jpg",
      avatarfull:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg",
      avatarhash: "fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb",
      lastlogoff: 1693532081,
      personastate: 0,
      primaryclanid: "103582791429521408",
      timecreated: 1283739538,
      personastateflags: 0,
      relationship: "friend",
      friendsince: 1634692171,
    },
    {
      steamid: "76561198062000703",
      communityvisibilitystate: 3,
      profilestate: 1,
      personaname: "Term",
      profileurl: "https://steamcommunity.com/id/_terminus14/",
      avatar:
        "https://avatars.steamstatic.com/eab71f1cb5d312c9b801e04a8da8b81d246bf6af.jpg",
      avatarmedium:
        "https://avatars.steamstatic.com/eab71f1cb5d312c9b801e04a8da8b81d246bf6af_medium.jpg",
      avatarfull:
        "https://avatars.steamstatic.com/eab71f1cb5d312c9b801e04a8da8b81d246bf6af_full.jpg",
      avatarhash: "eab71f1cb5d312c9b801e04a8da8b81d246bf6af",
      lastlogoff: 1693823129,
      personastate: 4,
      primaryclanid: "103582791434476706",
      timecreated: 1334459945,
      personastateflags: 0,
      relationship: "friend",
      friendsince: 1648350663,
    },
    {
      steamid: "76561198040366189",
      communityvisibilitystate: 3,
      profilestate: 1,
      personaname: "Regular Tetragon",
      commentpermission: 1,
      profileurl: "https://steamcommunity.com/id/regulartetragon/",
      avatar:
        "https://avatars.steamstatic.com/85ee384bec86399cc79728cbde046516fa704b23.jpg",
      avatarmedium:
        "https://avatars.steamstatic.com/85ee384bec86399cc79728cbde046516fa704b23_medium.jpg",
      avatarfull:
        "https://avatars.steamstatic.com/85ee384bec86399cc79728cbde046516fa704b23_full.jpg",
      avatarhash: "85ee384bec86399cc79728cbde046516fa704b23",
      lastlogoff: 1693805025,
      personastate: 4,
      realname: "Vael Mattingly",
      primaryclanid: "103582791435763797",
      timecreated: 1302294837,
      personastateflags: 0,
      relationship: "friend",
      friendsince: 1649989273,
    },
    {
      steamid: "76561198121423211",
      communityvisibilitystate: 3,
      profilestate: 1,
      personaname: "el_nave",
      profileurl: "https://steamcommunity.com/profiles/76561198121423211/",
      avatar:
        "https://avatars.steamstatic.com/1f48ca0206ad63f430b35173c0c994d26e8fed91.jpg",
      avatarmedium:
        "https://avatars.steamstatic.com/1f48ca0206ad63f430b35173c0c994d26e8fed91_medium.jpg",
      avatarfull:
        "https://avatars.steamstatic.com/1f48ca0206ad63f430b35173c0c994d26e8fed91_full.jpg",
      avatarhash: "1f48ca0206ad63f430b35173c0c994d26e8fed91",
      lastlogoff: 1692760065,
      personastate: 0,
      primaryclanid: "103582791429521408",
      timecreated: 1388690569,
      personastateflags: 0,
      relationship: "friend",
      friendsince: 1592096466,
    },
    {
      steamid: "76561198164668273",
      communityvisibilitystate: 3,
      profilestate: 1,
      personaname: "ProToType",
      profileurl: "https://steamcommunity.com/id/bruuitssam/",
      avatar:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb.jpg",
      avatarmedium:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_medium.jpg",
      avatarfull:
        "https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg",
      avatarhash: "fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb",
      lastlogoff: 1693540243,
      personastate: 1,
      realname: "Samuel chance",
      primaryclanid: "103582791429521408",
      timecreated: 1416698360,
      personastateflags: 0,
      loccountrycode: "US",
      relationship: "friend",
      friendsince: 1634692088,
    },
  ];
}

Getting Users Recently Played Games

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getRecentlyPlayedGames = async () => {
    // argument: steamId
    return await steam.users.getRecentlyPlayedGames(STEAM_ID);
}

Getting User Owned Games

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getOwnedGames = async () => {
    // argument: steamId
    return await steam.users.getOwnedGames(STEAM_ID);
}

Getting User Steam Level

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getUserSteamLevel = async () => {
    // argument: steamId
    return await steam.users.getUserSteamLevel(STEAM_ID);
}

Getting User Badges

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getUserBadges = async () => {
    // argument: steamId
    return await steam.users.getUserBadges(STEAM_ID);
}

Getting Community Badge Progress

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getUserCommunityBadgeProgress = async (badgeId) => {
    // argument: steamId, badgeId
    return await steam.users.getUserCommunityBadgeProgress(STEAM_ID, badgeId);
}

Getting User Public Account

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getUserCommunityBadgeProgress = async () => {
    // argument: steamId
    return await steam.users.getAccountPublicInfo(STEAM_ID);
}

Getting user ban status

require('dotenv').config();

const Steam =require("node-steam-api")
const key = process.env.STEAM_API_KEY
const steam = new Steam(key)

const STEAM_ID = "76561198995017863"

const getPlayerBans = async () => {
    // argument: steamId
    return await steam.users.getPlayerBans(STEAM_ID);
}

APP methods coming soon