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-market-info

v1.0.1

Published

A Node.js module to retrieve item information from the Steam Market.

Downloads

19

Readme

Steam Market Info - NodeJS

npm version license

A module to retrieve item information from the Steam Market.

Description

Steam Market Info is a Node.js module that allows you to retrieve information about items from the Steam Market, such as the lowest price, median price, and volume of sales. It provides functionality to read items from a file, update their information from the Steam Market, print the updated items, and save them back to a file.

Installation

You can install this module via npm:

npm install steam-market-info

Dependencies

This project uses the following dependencies:

  • Node.js: >= 20.11.1
  • axios: ^1.7.3
  • jest: (dev dependency): ^29.7.0
  • jsdoc: (dev dependency): ^4.0.3

Usage

Manually creating items

// Single item
async function example() {
    const item = new Item('MP9 | Storm (Minimal Wear)', 730);
    
    await getItemsInfo(item);
    
    printItems(item);
}

// Multiple items
async function example() {
    const items = [
        new Item('MP9 | Storm (Minimal Wear)', 730),
        new Item('AK-47 | Redline (Field-Tested)', 730)
    ];

    await getItemsInfo(item);

    printItems(item);
}

Reading and saving items from a file

// Single item
async function example() {
    const item = await readItemsFromFile('path/to/input/file.txt');
    
    await getItemsInfo(item);
    
    await saveItemsToFile('path/to/output/file.txt');
}

// Multiple items
async function example() {
    const items = await readItemsFromFile('path/to/input/file.txt');

    await getItemsInfo(item);

    await saveItemsToFile('path/to/output/file.txt');
}

Methods

readItemsFromFile(filePath)

Reads item(s) from a file.

Parameters:

  • fielPath (string) - The path to the file containing item data.

Returns:

  • Promise<Item[]> - A promise that resolves to an array of Item instances.

Notes:

  • The input file should follow the format: "name" appId currencyId.
  • Each line represents an item with its name in quotes, the corresponding application ID, and an optional currency ID (default is 1 for USD, for more information go to https://partner.steamgames.com/doc/store/pricing/currencies).

saveItemsToFile(filePath, items)

Saves item(s) to a file.

Parameters:

  • fielPath (string) - The path to the file where the item data will be saved.
  • items (Item | Item[]) - The item or list of items to save.

Returns:

  • Promise<void> - A promise that resolves when the file has been written.

Note:

  • The output file will follow the format: "name" | lowestPrice | medianPrice | volume.
  • Each item is saved on a new line with its properties separated by pipes (|). If a value is not provided, it defaults to an empty string.

getItemsInfo(items)

Updates item's information from the Steam Market.

Parameters:

  • items (Item | Item[]) - The item or list of items to update.

Returns:

  • Promise<void> - A promise that resolves when all items are updated.

printItems(items)

Prints item(s) to the console.

Parameters:

  • items (Item | Item[]) - The item or list of items to print.

Returns:

  • void - This function does not return a value. It prints the items to the console.

Scripts

test

npm test

docs

npm run docs

example

npm run example

License

This project is licensed under the MIT License. See the LICENSE file for details.