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

bun-curl2

v0.0.38

Published

blazing fast, fetch-like HTTP client built with Bun and cURL in TypeScript.

Readme

BunCurl2 🚀

BunCurl2 is a super-fast, fetch-like HTTP client for Bun! Built and maintained as a solo project, it leverages Bun’s powerful child processes combined with cURL to deliver blazing performance, advanced TLS options, and flexible caching solutions.


✨ Features

  • Fetch-like API:
    Intuitive and familiar HTTP methods (GET, POST, etc.) with extended capabilities.
  • Lightning Fast:
    Powered by Bun’s child processes and optimized cURL integration.
  • HTTP/2 & HTTP/3 Support:
    Take advantage of modern protocols (requires appropriate cURL build).
  • Custom TLS & Ciphers:
    Enhance security by fine-tuning TLS settings.
  • Flexible Caching:
    • Default (recommended): Redis, ideal for persistent or long-lived caching.
    • Optional: Local, memory-based caching using JavaScript's Map object, suitable for short-term caching within the same process.
  • Type-Safe Requests & Responses:
    Enjoy clear and maintainable TypeScript typings.

📜 Changelog

What's New?
Stay informed about updates and improvements by checking Changelog.


⚙️ Installation

bun add bun-curl2

📋 Requirements

| Tool | Minimum Version | Recommended Version | | ---- | --------------- | ------------------- | | Bun | ^1.2.0 | Latest | | cURL | ^7.0.0 | Latest |

Note: For optimal performance and compatibility, always use the latest versions.
I personally use stunnel/static-curl with quictls for cURL builds.


📡 Usage

Recommended: Creating a Client Instance

This approach provides the best experience with advanced configurations and caching.

import BunCurl2, { RequestInit, ResponseInit } from 'bun-curl2';

// Create a new client with customized options and caching.
const client = new BunCurl2({
  defaultAgent: 'MyCustomAgent/1.0',
  compress: true,
  cache: {
    mode: 'redis', // Recommended caching mode
    options: { url: 'redis://localhost:6379' },
    defaultExpiration: 60, // Cache expiration in seconds
  },
  tcp: {
    fastOpen: true,
    noDelay: true,
  },
  transformRequest: opts => opts,
});

// (Optional) Initialize cache if caching is enabled.
await client.connect();

// Make a GET request with type-safe response handling:
const req: ResponseInit<Record<string, string>> = await client.get(
  'https://api.example.com/data',
  { cache: true }
);

/*
Response Details:
- status: HTTP status code
- response: Parsed response (here: Record<string, string>)
- headers: Headers instance
- Helper methods: json(), text(), arrayBuffer(), blob()
*/
console.log('Status:', req.status);
console.log('Response:', req.response);

Alternative: Direct fetch-like Usage

For simpler use cases, you can directly use a familiar fetch-like syntax:

import { fetch } from 'bun-curl2';

const req: ResponseInit<string> = await fetch<string>(
  'https://www.example.com'
);

console.log('Status:', req.status);
console.log('Response:', req.response);

🤝 Contributing

Your feedback, issues, or pull requests are welcomed!


🏳️ License

This project is licensed under the WTFPL.