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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xfaider/node-steam-inventory

v1.1.0

Published

A module for interacting with steam for getting users inventory

Readme

node-steam-inventory

npm version

A module for interacting with steam for getting users inventory

Two endpoints

Steam has two endpoints:

  • https://steamcommunity.com/profiles/STEAM_ID/inventory/json/APP_ID/CONTEXT_Id/ (OLD)
  • https://steamcommunity.com/inventory/STEAM_ID/APP_ID/CONTEXT_Id/ (NEW)

You can see their differences in stackoverflow. In this module you can use both of them.

Installation

npm install @xfaider/node-steam-inventory

Usage

var steamInventoryModule = require('@xfaider/node-steam-inventory');
var steamInventory = new steamInventoryModule.SteamUserInventory(options);

Constructor params

Params:

  • options[defaultGotOptions]: default options for got module for all call methods. Default: {}.

Basic usage

steamInventory.loadAndFormat({
    steamId: userSteamId
}).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

API

Instance methods

loadFromOldEndPoint

Load steam inventory from old endpoint

steamInventory.loadFromOldEndPoint(params).then(response => {
    console.log(response);
    // `got` response`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for request | | params[steamId] | String|Number | Empty string | User steam id | | params[appId] | Number | 730 (CSGO App id) | Steam application id | | params[contextId] | Number | 2 | Steam context id | | params[gotOptions] | Object | {} | Options for got module |

loadFromOldEndPointAndFormat

Load steam inventory from old endpoint and format data

steamInventory.loadFromOldEndPointAndFormat(params).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadFromOldEndPoint |

loadFromNewEndPoint

Load steam inventory from new endpoint

steamInventory.loadFromNewEndPoint(params).then(response => {
    console.log(response);
    // `got` response`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for request | | params[steamId] | String|Number | Empty string | User steam id | | params[appId] | Number | 730 (CSGO App id) | Steam application id | | params[contextId] | Number | 2 | Steam context id | | params[language] | String | english | Language for some fields in response | | params[count] | Number | 5000 (For steam maximum is 5000) | Limit of items in response | | params[cursor] | String|Number | null | Asset id of steam item working as cursor for pagination | | params[gotOptions] | Object | {} | Options for got module |

loadAllDataFromNewEndPoint

Load steam inventory from new endpoint with all pages fetching. Because of highly ratelimited steam endpoint , you need to use different IPs, or different proxies for each request (use getGotOptionsPromise for it)

steamInventory.loadAllDataFromNewEndPoint(params, getGotOptionsPromise).then(responses => {
    console.log(responses);
    // array of `got` responses
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for request | | params[steamId] | String|Number | Empty string | User steam id | | params[appId] | Number | 730 (CSGO App id) | Steam application id | | params[contextId] | Number | 2 | Steam context id | | params[language] | String | english | Language for some fields in response | | params[perPage] | Number | 5000 (For steam maximum is 5000) | Limit of items per response | | params[gotOptions] | Object | {} | Options for got module | | getGotOptionsPromise | Function | return Promise.resolve(params.gotOptions) | Function returning Promise, resolving gotOptions for each request |

loadFromNewEndPointAndFormat

Load steam inventory from new endpoint and format data

steamInventory.loadFromNewEndPointAndFormat(params).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadFromNewEndPoint |

loadFromNewEndPointNextPage

Load next page steam inventory from new endpoint

steamInventory.loadFromNewEndPointNextPage(params, previousResponse).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadFromNewEndPoint | | previousResponse | Object | undefined | Steam response from new endpoint |

loadAllDataFromNewEndPointAndFormat

Load steam inventory from new endpoint with all pages fetching and format it

steamInventory.loadAllDataFromNewEndPointAndFormat(params, getGotOptionsPromise).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadAllDataFromNewEndPoint | | getGotOptionsPromise | Function | null | See this parameter in loadAllDataFromNewEndPoint|

load

Load steam inventory from new or old endpoints

steamInventory.load(params, useNewEndPoint, getGotOptionsPromise).then(responses => {
    console.log(responses);
    // array of `got` responses
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadAllDataFromNewEndPoint or loadFromOldEndPoint| | useNewEndPoint | Boolean | true | Flag for using new endpoint (or old) | | getGotOptionsPromise | Function | null | See this parameter in loadAllDataFromNewEndPoint|

loadAndFormat

Main method. Load steam inventory from new or old endpoints and format it

steamInventory.loadAndFormat(params, useNewEndPoint, getGotOptionsPromise).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | params | Object | undefined | Parameters for method loadAllDataFromNewEndPointAndFormat or loadFromOldEndPointAndFormat| | useNewEndPoint | Boolean | true | Flag for using new endpoint (or old) | | getGotOptionsPromise | Function | null | See this parameter in loadAllDataFromNewEndPointAndFormat|

Static methods

requestJSON

JSON request

SteamUserInventory.requestJSON(url, gotOptions).then(respone => {
    console.log(response);
    // `got` response
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | url | String | undefined | URL for request | | gotOptions | Object | undefined | Options for got module |

getItemClassInstanceString

Get item special string class_id + _ + instance_id

let steamItem = {classid: 98, instanceid: 115};
SteamUserInventory.getItemClassInstanceString(steamItem).then(str => {
    console.log(str);
    // 98_115
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | steamItem | Object | undefined | Steam item object from response | | steamItem[classid] | String|Number | undefined | Steam item class_id | | steamItem[instanceid] | String|Number | undefined | Steam item instance_id |

getItemImageUrl

Get item image (normal or large)

let steamItem = {icon_url_large: '__href__'};
let large = true;
SteamUserInventory.getItemImageUrl(steamItem, large).then(str => {
    console.log(str);
    // https://steamcommunity-a.akamaihd.net/economy/image/__href__
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | steamItem | Object | undefined | Steam item object from response | | steamItem[icon_url_large] | String | undefined | Steam item icon_url_large | | steamItem[icon_url] | String | undefined | Steam item icon_url | | large | Boolean | true | Get large image flag |

getInspectItemLink

Get item inspect link

let steamItem = {
    actions: [
        {item: 'Inspect in Game...', link: 'test_link'}
    ]
};
SteamUserInventory.getInspectItemLink(steamItem).then(str => {
    console.log(str);
    // test_link
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | steamItem | Object | undefined | Steam item object from response | | steamItem[actions] | Array | undefined | Steam item actions |

formatItem

Format item

SteamUserInventory.formatItem(itemData).then(formatted => {
    console.log(formatted);
    // {
    //     id: '14364197067',
    //     assetId: '14364197067',
    //     amount: '1',
    //     classId: '2777986317',
    //     instanceId: '188530139',
    //     raw: { base: [Object], description: [Object] },
    //     appId: 730,
    //     name: 'Five-SeveN | Monkey Business',
    //     marketHashName: 'Five-SeveN | Monkey Business (Well-Worn)',
    //     tradable: 1,
    //     marketable: 1,
    //     marketTradableRestriction: 7,
    //     link: 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S%owner_steamid%A%assetid%D11673583149302548085',
    //     imageLarge: 'https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposLOzLhRlxfbGTj5X09q_goWYkuHxPYTTl2VQ5sROh-zF_Jn4t1i1uRQ5fTvzdoGWdwdvMFzU_FbolerujJHptcjAwXo37yUrtyuOyRbliU4aPOdxxavJhXiz6dw',
    //     imageSmall: 'https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposLOzLhRlxfbGTj5X09q_goWYkuHxPYTTl2VQ5sROh-zF_Jn4xlbkqURvZmiidYKRdAFoNVzR81bryLvmjZ7o6ZjAmyYw7CNw7SmLzRepwUYbn3RWfTI',
    //     image: 'https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgposLOzLhRlxfbGTj5X09q_goWYkuHxPYTTl2VQ5sROh-zF_Jn4t1i1uRQ5fTvzdoGWdwdvMFzU_FbolerujJHptcjAwXo37yUrtyuOyRbliU4aPOdxxavJhXiz6dw',
    //     category: null,
    //     type: undefined,
    //     exterior: undefined,
    //     quality: undefined
    // }
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | steamItem | Object | undefined | Steam item object from response | | steamItem[base] | Object | undefined | Base steam item data | | steamItem[description] | Object | undefined | Description steam item data |

formatData

Format response data (result is array of objects formatted by formatItem)

SteamUserInventory.formatData(items, descriptions).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | items | Object | undefined | Object with base item data | | descriptions | Object | undefined | Object with description item data |

formatDataFromOldEndPoint

Format response data from old endpoint(see result formatData)

SteamUserInventory.formatDataFromOldEndPoint(data).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | data | Object | undefined | Data in response from old steam endpoint |

formatDataFromNewEndPoint

Format response data from new endpoint(see result formatData)

SteamUserInventory.formatDataFromNewEndPoint(data).then(formattedArray => {
    console.log(formattedArray);
    // Array of objects formatted by `formatItem`
});

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | data | Object | undefined | Data in response from new steam endpoint |