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

pubg-royale

v2.1.1

Published

A pubg api wrapper with built-in caching

Downloads

15

Readme

PUBG Royale

This is a PUBG API wrapper for Node.js with built-in caching that originated from the statg discord bot. There might be better wrappers out there, but feel free to use this one if you like ;)

Features

  • Get infos and statistics about players, matches, seasons, tournaments, api status.
  • All api calls are asynchronious with promises.
  • Results are cached. Cache timings can be configured.
  • API results are automatically parsed to Javascript objects.
  • API errors are converted to native Javascript errors for easier error handling.
  • Works for PC regions "steam" and "kakao".

The composition of the objects returned by pubg-royle match the JSON returned by the PUBG API. So be sure to read the relevant parts of the official docs.

Install

npm install pubg-royale

Also make sure to grab a key for the PUBG API here. IMPORTANT: Keep your key secret!

Use

const pubgRoyale = require('pubg-royale');

const client = new pubgRoyale.Client({
  // Put your api key here
  key: 'YOUR_KEY_HERE',

  // Default region used for api calls. Defaults to "steam" if omitted.
  // The region can be set for individual api calls.
  defaultRegion: pubgRoyale.REGIONS.PC.STEAM,

  // Specifies ttl in ms for cached objects. Any value ommited defaults to 60 seconds.
  // Set every value to zero to disable caching
  cache: { 
    player: 10 * 1000,
    playerStats: 10 * 1000,
    match: 10 * 1000,
    status: 10 * 1000,
    seasons: 10 * 1000,
  },
});

client.player({ name: 'JohnDoe' })
  .then((player) => {
    // do something with the player
  })
  .catch((error) => {
    // handle error
  });

Changelog

1.1.0

  • Support for pubg api v6.0.0 style seasons stats url format (fixes #4)

2.0.0

  • Support for new grouped PC regions "steam" and "kakao". Support for console regions dropped for now.

2.1.0

  • added lifetimeStats() which can be used to fetch lifetime stats of a player

2.1.1

  • Security updates

License

MIT