项目作者: SnaBe

项目描述 :
An asynchronous node module for fetching item prices, images and listings from the Steam Community Market.
高级语言: JavaScript
项目地址: git://github.com/SnaBe/node-steam-market-fetcher.git
创建时间: 2020-03-29T14:55:12Z
项目社区:https://github.com/SnaBe/node-steam-market-fetcher

开源协议:MIT License

下载


steam-market-fetcher

A Node.js wrapper for the Steam Community Market API.

npm version
node version
npm test
dependencies
npm downloads
license
paypal

Installation

Using npm:

  1. $ npm install steam-market-fetcher

Using yarn:

  1. $ yarn add steam-market-fetcher

Testing

Note: Make sure you’ve supplied a valid steamLoginSecure cookie in the test.js file.

Using npm:

  1. $ npm test

Using yarn:

  1. $ yarn test

Examples

Importing with ES6’s import statement.

  1. import SteamMarketFetcher from 'steam-market-fetcher';

Instantiating with the currency and format options.

  1. const market = new SteamMarketFetcher({
  2. currency: 'EUR',
  3. format: 'json'
  4. });

Asynchronous requests with callbacks.

  1. market.getItemPrice({
  2. market_hash_name: 'AK-47 | Redline (Field-Tested)',
  3. appid: 730,
  4. callback: (err, price) => {
  5. if (err) throw err;
  6. console.log(price);
  7. }
  8. });

Asynchronous requests with async/await.

  1. (async () => {
  2. try {
  3. const image = await market.getItemImage({
  4. market_hash_name: 'Mann Co. Supply Crate Key',
  5. appid: 440
  6. });
  7. console.log(image);
  8. } catch (error) {
  9. console.error('An error occurred: ', error);
  10. }
  11. })();

Some more examples are available in the test directory.

Documentation

Version 3.0.0 includes breaking changes, please see the newly updated Wiki pages for further documentation.

License

MIT

Copyright 2024, Simon Sørensen