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

@yukiakai/tls-fetch

v2.0.2

Published

Rust native HTTP client emulating real browser TLS handshakes.

Readme

@yukiakai/tls-fetch

NPM Version NPM Downloads

Native Rust-powered HTTP client with TLS fingerprint bypass – for stealthy and high-performance web scraping or automation.

@yukiakai/tls-fetch is a native Node.js module (built with Rust & napi-rs) designed to bypass browser fingerprint authentication by simulating low-level TLS handshakes that resemble real browsers. Note: macOS is not supported.


Features

  • ✅ Real-browser TLS/JA3 fingerprint emulation
  • ✅ Native performance (Rust + Tokio under the hood)
  • ✅ Seamless Node.js integration (via napi-rs)
  • ✅ Supports proxy (HTTP, HTTPS, SOCKS5)
  • ✅ Modern fetch-like API design
  • ✅ Lightweight, no Puppeteer or headless browser needed

Installation

npm install @yukiakai/tls-fetch

System Requirements

  • Node.js 16+
  • glibc ≥ 2.35 (ships with Ubuntu 22.04+ or equivalent)

Usage

CommonJS

const { TLSFetch } = require('@yukiakai/tls-fetch');

TLSFetch.get('https://example.com', {
  headers : { 'User-Agent': 'Mozilla/5.0 ...' },
}).then(res => { /* todo */})

ESM

import { TLSFetch }  from '@yukiakai/tls-fetch';

const res = await TLSFetch.post('https://example.com/api', {
  headers: { 'Content-Type': 'application/json' },
  body: Buffer.from(JSON.stringify({ foo: 'bar' })),
});
console.log(res.statusCode);

API

See docs: API docs

All methods are Promise-based and use Buffer for binary-safe transmission.

get(url: string, options?: HttpOptions): Promise<HttpResponse>

Performs a GET request with browser-like TLS fingerprinting.

import { tlsFetch } from '@yukiakai/tls-fetch'

const res = await tlsFetch.get('https://example.com', {
  headers : { 'User-Agent': 'Mozilla/5.0 ...' },
})
console.log(res.statusCode, res.headers, res.text())

post(url: string, options?: HttpOptions): Promise<HttpResponse>

Sends a POST request.

import { TLSFetch } from '@yukiakai/tls-fetch'

const res = await TLSFetch.post('https://api.example.com', {
  headers: { 'Content-Type': 'application/json' },
  body: Buffer.from(JSON.stringify({ foo: 'bar' }))
})

fetch(url: string, options: RequestOptions): Promise<HttpResponse>

Generic method supporting any HTTP verb.

import { fetch } from '@yukiakai/tls-fetch'

const res = await fetch('https://api.example.com/item/123', {
  method: 'PUT',
  headers: { 'Authorization': 'Bearer token' },
  body: Buffer.from('payload'),
  proxy: 'http://127.0.0.1:8080'
})

stream(url: string, filePath: string, options?: RequestOptions): Promise<HttpStreamResponse>

Stream response directly to a file.

import { TLSFetch } from '@yukiakai/tls-fetch'

await TLSFetch.stream('https://cdn.example.com/video.mp4', './video.mp4')

Upgrade Guide to V2

Version v2 introduces several important changes compared to v1:

1. Fully rewritten in TypeScript

  • The library is now fully written in TypeScript with strict typing.
  • Provides better IDE autocomplete and reduces type-related bugs.

2. Uses N-API v3

  • Improves request/response performance compared to v1.
  • Fully compatible with modern Node.js and other platforms (Linux, Windows)(x64, arm).

3. Internal TLS change

  • From v2, @yukiakai/tls-fetch bundles its own OpenSSL.
  • You no longer need to install or link against the system’s OpenSSL library.

4. Major API changes

a. tlsFetch.post / tlsFetch.get / tlsFetch.delete

  • These methods now use HttpOptions instead of the old RequestOptions.
  • RequestOptions still exists, but is now only used for the generic fetch() method.

Example:

// v2
tlsFetch.post(url, { body, headers }); // HttpOptions
tlsFetch.fetch(url, { method: "POST", body, headers }); // RequestOptions (generic)

Make sure to update all calls to post/get/delete/... to use the new HttpOptions interface.


b. Response.headers

Before (v1):

headers: Record<string, string>

After (v2):

headers: Record<string, string | string[] | undefined>

Supports headers with multiple values or undefined. If your code reads headers['some-header'] directly, check the type before using:

const value = response.headers['set-cookie'];
if (Array.isArray(value)) {
  value.forEach(cookie => console.log(cookie));
} else if (value) {
  console.log(value);
}

c. No more default import

  • v2 does not support default import.
  • Update your import statements:
// Old v1 style
import tlsFetch from '@yukiakai/tls-fetch';

// New v2 style
import { TLSFetch } from '@yukiakai/tls-fetch';

This is required for TypeScript strict mode and better tree-shaking.


4. How to upgrade

  1. Update your package:
npm install @yukiakai/tls-fetch@latest
  1. Change all calls to post/get/delete/... to use HttpOptions.
  2. For generic requests, use fetch() with RequestOptions.
  3. Update all import statements to named import:
import { TLSFetch } from '@yukiakai/tls-fetch';
  1. Review all usage of Response.headers → make sure your code handles string | string[] | undefined.
  2. Rebuild your project if using TypeScript.

Tip: v2 is optimized for speed with N-API v3, so you’ll notice significant improvements when performing many parallel requests or handling large data.


Use Cases

  • Bypass anti-bot browser checks
  • Access sites using real browser-like TLS handshakes
  • Fetch through proxies (for scraping, automation)
  • Download large files directly to disk (stream mode)

Notes

  • Requires Node.js 16+
  • Compatible with Linux and Windows

Changelog

See full release notes in CHANGELOG.md


License

MIT © Yuki


Contributing

PRs and issues welcome. Native TLS customization contributions especially appreciated.