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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@r6-data-js/runtime

v0.1.0

Published

Runtime layer for r6-data.js with caching, request deduplication, retry, timeout and local rate limiting.

Downloads

104

Readme

@r6-data-js/runtime

Optional runtime layer for r6-data.js with memory caching, request deduplication, retry, timeout and local rate limiting.

This package does not replace r6-data.js. You still create and configure the main R6Client yourself, then pass that instance to createR6Runtime.

It does not make direct API calls to R6Data and has no runtime dependencies.

Installation

npm install r6-data.js @r6-data-js/runtime

Basic Usage

import { R6Client } from 'r6-data.js';
import { createR6Runtime } from '@r6-data-js/runtime';

const client = new R6Client({ apiKey: process.env.R6_DATA_API_KEY! });
const r6 = createR6Runtime(client);

const stats = await r6.players.getPlayerStats({
  nameOnPlatform: 'PlayerName',
  platformType: 'uplay',
  platform_families: 'pc',
  board_id: 'ranked',
});

Memory Cache

import { R6Client } from 'r6-data.js';
import { createR6Runtime, MemoryCacheAdapter } from '@r6-data-js/runtime';

const client = new R6Client({ apiKey: process.env.R6_DATA_API_KEY! });

const r6 = createR6Runtime(client, {
  cache: new MemoryCacheAdapter(),
  ttl: 60_000,
});

MemoryCacheAdapter supports TTL, delete() and clear(). Expired entries are removed when they are read. It does not use a required setInterval.

Retry And Timeout

const r6 = createR6Runtime(client, {
  timeout: 10_000,
  retry: {
    retries: 2,
    delayMs: 500,
    retryOn: [408, 429, 500, 502, 503, 504],
  },
});

Retry uses a simple backoff: delayMs * attempt. Timeout rejects with R6RuntimeTimeoutError.

Local Rate Limit

const r6 = createR6Runtime(client, {
  rateLimit: {
    maxRequests: 5,
    intervalMs: 1000,
  },
});

The rate limiter is an in-memory queue. It limits local execution only; it does not coordinate across multiple processes or servers.

Custom Cache Adapter

import type { CacheAdapter } from '@r6-data-js/runtime';

class MyCache implements CacheAdapter {
  private values = new Map<string, unknown>();

  get(key: string) {
    return this.values.get(key);
  }

  set(key: string, value: unknown) {
    this.values.set(key, value);
  }

  delete(key: string) {
    this.values.delete(key);
  }

  clear() {
    this.values.clear();
  }
}

@r6-data-js/runtime intentionally does not include Redis, PostgreSQL, MongoDB or other databases. Use CacheAdapter if your app needs a custom cache backend.

Options

createR6Runtime(client, {
  cache,
  ttl,
  dedupe,
  timeout,
  retry,
  rateLimit,
  cacheKey,
  shouldCache,
  onRequest,
  onResponse,
  onError,
});
  • cache: CacheAdapter or false. Disabled by default.
  • ttl: cache TTL in milliseconds.
  • dedupe: avoids simultaneous duplicate calls with the same method path and args. Enabled by default.
  • timeout: timeout in milliseconds.
  • retry: retry settings for configured HTTP status codes.
  • rateLimit: local queue settings.
  • cacheKey: custom cache key function.
  • shouldCache: decide whether a result should be cached.
  • onRequest, onResponse, onError: lightweight lifecycle hooks.

License

MIT