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 🙏

© 2025 – Pkg Stats / Ryan Hefner

teetojs

v0.5.1

Published

Node.js Riot API Wrapper with integrated Redis rate limiter

Downloads

5

Readme

TeetoJS

TeetoJS is a lightweight Node.js Riot API wrapper, ready for multi-instances szenarios with the help of redis. It has around 300 lines of code only, offers priority queuing of API requests, an integrated rate-limiter and is easy to customize.

Installation

npm install teetojs --save

Usage

const TeetoJS = require("teetojs");
let api = TeetoJS("RGAPI-KEY-HERE", {
  redis: {
    host: "YOUR-HOSTNAME",
    port: 6379, // or whatever port you have
    db: 1,
    password: "YOUR-PASSWORD"
  }
});

api
  .get("euw", "summoner.getBySummonerName", encodeURIComponent("TheCraccer"))
  .then(res => console.log(res))
  .catch(err => console.log(err));

api
  .get("na1", "match.getMatchlist", 0, 78247)
  .then(res => console.log(res))
  .catch(err => console.log(err));

All requests are done via .get(...).

  • The first argument is the region.
  • The second is the endpoint path (see config.json).
  • The third argument is the priority of the request. 1 for high, 0 for normal
  • Then come any path arguments (usually zero or one, or two for getChampionMastery) which are for summoner/match IDs, names, etc.
  • Last is an optional object for any query parameters. (Important: You should encode names when searching for summoners, because some characters need to be encoded to be found from riot)

Configuration

To customize the wrapper TeetoJS takes options as second argument which is a configuration object. config.json is used by default. The supplied option object will override any corresponding values in the config. The configuration specifies the number of retries, backOffTimings, loggings, endpoints, your redis config and everything else. You should at least give your valid redis config to make the wrapper work.

config Object

  • debug [boolean]: Weather to show debug outputs or not
  • namespacePrefix [string]: Add a prefix if you have multiple limits running that need to be counted seperately. NOTE: Dev and Prod environments are already seperated via environment variables
  • showWarn [boolean]: Weather to console.error occuring 429 errors or not
  • exceededCallback [func(err)]: Callback to be called if a 429 error appeared. Parameter is an error object containing headers and url
  • applimit [array]: Your apiKey application limits, e.g. ["20:1","100:120"]
  • spreadToSlowest [boolean]: All requests are spreaded according to your slowest limit. Set this value to false to only respect your smaller limits (e.g. your 10s limit). Recommendation: Use true for production
  • edgeCaseFixValue [number]: Since Riot resets it's limits by their own time there is a small edge case where requests are resetted in the wrapper but not at riot. This value slows down your requests, so that this does not happen to often. A value of 1.1 means that you are running at 90% speed. WARNING: Setting this value very low might cause 429-errors.
  • maxRetriesAmnt [number]: Number of retries after getting a 429, 500 or 503 error before aborting the request
  • retryMS [number]: Default time before retrying a failed request. This value only applies to 429 retries if retry-after is not given in the riot response

Rate-Limiting

To rate limit all your requests accross multiple instances, this wrapper is using a modified version of the rolling-rate-limiter from classdojo.