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

torn-api-client

v1.0.1

Published

API client for the official Torn API

Readme

torn-api-client

Unofficial API client for the official Torn API. This API client provides a simplified interface on the Torn API, which should make integration of Torn into JS applications even easier.

Features

  • Configurable TornClient class with convenience methods to call each endpoint/compartment.
  • List of available selections for each compartment.
  • Full type definitions for the above to make integration in Typescript projects easier.

Example

Try it out using this example below.

import TornClient, { api } from 'torn-api-client';
const client = new TornClient('my-api-key');

// Get the default from the user compartment of the API key owner.
client.user().then(console.log);
// Get the perks info from the user compartment of the API key owner.
client.user(null, ['perks']).then(console.log);
// Get the basic and icons info for a user with id 887766.
client.user('887766', ['basic', 'icons']).then(console.log);

// Get the default section from the faction compartment for faction with id 1234.
client.faction('1234').then(console.log);
// Get the employees section from the company compartment for company with id 9101.
client.company('9101', ['employees']).then(console.log);

// Use the api object to select compartments
client.company('9101', [api.company.employees]).then(console.log);

// ... And more, like torn, properties and item-market!

Future additions

This API is far from finished so a lot will be added or updated. Below is an (incomplete) list of items that might be added in the future:

  1. API response types.
  2. Improved testing and coverage reports.
  3. Better client configurations.
  4. More example scripts in both TS and JS.

Installation

The NPM package is published here, https://www.npmjs.com/package/torn-api-client.

Simply install it using npm install torn-api-client.

Contributing

  1. Get your API key from the Torn website.

  2. After running yarn install and yarn build you can use the scripts in the scripts/ directory.

    For your testing convenience it is advisable to set your API key as environment variable called TORN_API_KEY. The scripts will use this to fill in the key when creating the client.

Feel free to open issues to suggest improvements or additional features. Contributions are more than welcome, both in the form of PR's and issues.