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

steam-api-sdk

v1.6.1

Published

A Node.js wrapper for the Steam Web API, includes many tools for fetching and parsing data from the Steam Web API.

Downloads

475

Readme

Steam-API-SDK

This package includes many functions to use along with the Steam API. It is a work in progress and will be updated over time. Currently it includes some basic and advanced functions to fetch data about users.

Installation

Install from npm using the following command:

npm install steam-api-sdk

or if you are using yarn:

yarn add steam-api-sdk

Getting Started

You have 2 ways to use this package:

• By using an .env file:

First add an environment variable to your .env file with the name STEAM_API_KEY and the value of your Steam API key. You can get your Steam API key from here.

.env example:

STEAM_API_KEY = 'web-api-key';

• By passing the API key as a parameter to the config file

Import config from the package and pass your Steam API key as a parameter to the config function.

import { config } from 'steam-api-sdk' // or const steam = require -> steam.config

config.apiKey = 'web-api-key'

Then import the package into your project:

const steam = require('steam-api-sdk')

Or if you are using ES6:

import steam from 'steam-api-sdk'

Thats all :)

Functions

Convert Steam32 to Steam64 ID ([U:1:XXX] ➜ 7656119XXX)

import { From32To64 } from 'steam-api-sdk'

const steam64 = From32To64([U:1:XXX]) // 7656119XXX

Convert Steam64 to Steam32 ID (7656119XXX ➜ [U:1:XXX])

import { From64To32 } from 'steam-api-sdk'

const steam32 = From64To32('7656119XXX') // [U:1:XXX]

Convert Steam64 to Steam ID (7656119XXX ➜ STEAM_0:0:XXX) Array

import { From64ToSteamID } from 'steam-api-sdk'

const steamIds = From64ToSteamID('7656119XXX')
// Array of: [STEAM_0:0:XXX, STEAM_0:1:XXX]

Convert Steam64 to a user object (7656119XXX ➜ object details about the user)

import { From64ToUser } from 'steam-api-sdk'

const user = From64ToUser('7656119XXX')
// User Object
const user = From64ToUser(['7656119XXX', '7656119XXX', '7656119XXX'])
// User Object Array

Please note that you can use string OR array of strings that contains the user's Steam64 id. you should use that if you want to get multiple users at once without getting rate limited by Steam and also reduce the response time! (instead of sending 50 requests for 50 users, it will send 1 request for 50 users = 50x faster)

Convert Steam64 to a user object (7656119XXX ➜ object details about the user)

import { GetSteamUser } from 'steam-api-sdk'

const user = GetSteamUser('https://steamcommunity.com/id/NXTShiNxz/')
// profile url -> User Object
const user = GetSteamUser('http://steamcommunity.com/profiles/76561198998419941')
// profile url (2) -> User Object
const user = GetSteamUser('STEAM_0:0:454468949')
// profile url (2) -> User Object
const user = GetSteamUser('76561198869203626')
// profile url (2) -> User Object

Convert Steam ID to steam64 ID (STEAM_0:0:454468949 ➜ 76561198869203626)

import { SteamIDToSteam64 } from 'steam-api-sdk'

const steam64 = SteamIDToSteam64('STEAM_0:0:454468949')
// 76561198869203626

Convert Steam Profile URL to steam64 ID (https://steamcommunity.com/id/XXX/ ➜ 76561198869203626)

import { VanityUrlTo64 } from 'steam-api-sdk'

const steam64 = VanityUrlTo64('https://steamcommunity.com/id/XXX/')
// 76561198869203626

Contributing

If you want to contribute to this package, please feel free to do so by opening a pull request with your changes. Currently this package is in development and will be updated over time. We are looking for contributors to help us improve this package by adding new functions and improving the existing ones.

Issues & Questions

If you have any questions or suggestions, please open an issue and I will get back to you as soon as possible.