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

eft-market-api

v1.2.0

Published

A TypeScript wrapper for the tarkov-market-api.

Downloads

14

Readme

Table of Contents

Disclaimer

This nodejs package is NOT an official package by the eft market team. I created this package for personal projects.

You can get your API key here.

Notice: to get your api key you must pledge the eft market developer on patreon.

This package and the new update (v1.2.0) are a improvement to the package since this project was created in the early days of my developing journey so I decided to revisit and improve this.

Use this with caution though, I did improve the codebase and added type definitions I did not pledge eft market again so I'm unable to test the changes.

Should this project - for whatever reason - recieve more attention than expected I might become a patreon again and revisit this once more.

Pull Requests Wellcome.

Description

This project is a TypeScript/JavaScript wrapper for the tarkov market api. I created this back in the day when I didn't know how to consume restful apis. Although I know it know I decided to not delete this project but keep it for nostalgic reasons.

How to Use

import { EftMarketAPI } from "eft-market-api";
const api = new EftMarketApi('yourapikey');

/**
 * Get an Array of all Items
 * 
 * @returns Promise of array of type Item
 */
api.GetAllItems()
  .then(data => {
    //do something
  })
  .catch(error => {
    console.error(error);
  });

/**
 * Get an Item by it's name or a part of it's name. Should the name
 * result in multiple hits an array of mutliple items is returned.
 * 
 * @param name part of the item's name or the full name
 * @returns Promise of array of type Item
 */
api.GetItemsByName("name")
  .then(data => {
    //do something
  })
  .catch(error => {
    console.error(error);
  });

/**
 * Get an Item by it's name or a part of it's name. Should the name
 * result in multiple hits an array of mutliple items is returned.
 * 
 * @param name part of the item's name or the full name
 * @returns Promise of array of type Item
 */
api.GetItemByUID("uid")
  .then(data => {
    //do something
  })
  .catch(error => {
    console.error(error);
  });

To simplify the work with TypeScript all methods use the Item class that looks like this:

export interface Item {
  uid: string
  name: string,
  tags: string[],
  shortName: string,
  price: number,
  basePrice: number,
  avg24hPrice: number,
  avg7daysPrice: number,
  traderName: string,
  traderPrice: number,
  traderPriceCur: string,
  updated: string,
  slots: number,
  diff24h: number,
  diff7days: number,
  icon: string,
  link: string,
  wikiLink: string,
  img: string,
  imgBig: string,
  bsgId: string,
  isFunctional: boolean,
  reference: string
}

perfectly representing the tarkov market object structure:

[
  {
    "uid": "5ac84494-465a-424a-b36e-fe22869ba5ec",
    "name": "Physical bitcoin",
    "tags": [
      "Barter"
    ],
    "shortName": "0.2BTC",
    "price": 374097,
    "basePrice": 123577,
    "avg24hPrice": 379526,
    "avg7daysPrice": 357188,
    "traderName": "Therapist",
    "traderPrice": 374097,
    "traderPriceCur": "₽",
    "updated": "2021-10-16T17:00:03.876Z",
    "slots": 1,
    "diff24h": -1.43,
    "diff7days": 4.73,
    "icon": "https://cdn.tarkov-market.com/images/items/physical_bitcoin_(btc)_sm.png",
    "link": "https://tarkov-market.com/item/physical_bitcoin_(btc)",
    "wikiLink": "https://escapefromtarkov.gamepedia.com/Physical_bitcoin",
    "img": "https://cdn.tarkov-market.com/images/items/physical_bitcoin_(btc)_sm.png",
    "imgBig": "https://cdn.tarkov-market.com/images/items/physical_bitcoin_(btc)_lg.png",
    "bsgId": "59faff1d86f7746c51718c9c",
    "isFunctional": true,
    "reference": "https://www.patreon.com/tarkov_market"
  }
]

License

MIT