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

trimpts

v0.1.0

Published

HTTP client with browser impersonation for Node.js

Readme

TrimpTS

A TypeScript HTTP client library with browser impersonation capabilities for Node.js.

Features

  • Browser Impersonation: Mimic Chrome, Safari, Edge, Firefox, and OkHttp across different operating systems
  • TypeScript Support: Full TypeScript definitions and type safety
  • Promise-based API: Modern async/await support
  • Comprehensive HTTP Methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
  • Authentication: Support for Basic Auth and Bearer tokens
  • SSL/TLS: Configurable SSL options including custom certificates
  • Cookies: Automatic cookie handling
  • Timeouts: Configurable request timeouts
  • Error Handling: Robust error handling with custom error types

Installation

npm install trimpts

Quick Start

import { AsyncClient } from 'trimpts';

// Create a client with browser impersonation
const client = new AsyncClient({
  impersonate: 'chrome',
  impersonate_os: 'windows'
});

// Make a simple GET request
const response = await client.get('https://api.example.com/users');
console.log(response.json());

API Reference

Client Classes

AsyncClient

Promise-based HTTP client with async/await support.

const client = new AsyncClient(options);

Client

Callback-based HTTP client.

const client = new Client(options);

Client Options

interface ClientOptions {
  timeout?: number;                    // Request timeout in milliseconds
  headers?: Record<string, string>;    // Custom headers
  auth?: {
    username?: string;
    password?: string;
    token?: string;
  };
  proxy?: {
    host: string;
    port: number;
    auth?: {
      username: string;
      password: string;
    };
  };
  cookies?: string;                    // Cookie string
  ssl?: {
    rejectUnauthorized?: boolean;
    ca?: string;
    cert?: string;
    key?: string;
  };
  userAgent?: string;                  // Custom User-Agent
  impersonate?: 'chrome' | 'safari' | 'edge' | 'firefox' | 'okhttp';
  impersonate_os?: 'android' | 'ios' | 'linux' | 'macos' | 'windows';
}

HTTP Methods

All clients support the following methods:

  • get(url, options?) - GET request
  • post(url, data?, options?) - POST request
  • put(url, data?, options?) - PUT request
  • patch(url, data?, options?) - PATCH request
  • delete(url, options?) - DELETE request
  • head(url, options?) - HEAD request
  • options(url, options?) - OPTIONS request

Response Object

interface Response {
  status: number;
  headers: Record<string, string | string[] | undefined>;
  data: string;

  json<T = any>(): T;    // Parse JSON response
  text(): string;        // Get text response
}

Error Types

  • RequestError - General request errors
  • TimeoutError - Request timeout errors

Browser Impersonation

TrimpTS can impersonate various browsers and operating systems:

// Chrome on Windows
const client = new AsyncClient({
  impersonate: 'chrome',
  impersonate_os: 'windows'
});

// Safari on macOS
const client = new AsyncClient({
  impersonate: 'safari',
  impersonate_os: 'macos'
});

// Firefox on Linux
const client = new AsyncClient({
  impersonate: 'firefox',
  impersonate_os: 'linux'
});

Examples

Basic Authentication

const client = new AsyncClient({
  auth: {
    username: 'user',
    password: 'pass'
  }
});

Bearer Token Authentication

const client = new AsyncClient({
  auth: {
    token: 'your-jwt-token'
  }
});

Custom Headers and Timeout

const response = await client.get('https://api.example.com/data', {
  headers: {
    'X-API-Key': 'your-api-key'
  },
  timeout: 10000
});

POST with JSON Data

const response = await client.post('https://api.example.com/users', {
  name: 'John Doe',
  email: '[email protected]'
});

SSL Configuration

const client = new AsyncClient({
  ssl: {
    rejectUnauthorized: false,  // For self-signed certificates
    ca: fs.readFileSync('ca.pem'),
    cert: fs.readFileSync('cert.pem'),
    key: fs.readFileSync('key.pem')
  }
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see the LICENSE file for details.