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

@renpwn/simplefetch

v0.0.2

Published

Minimal, audit-friendly fetch utility with auto engine fallback (native, axios, cookie, puppeteer)

Readme

simpleFetch

Minimal, audit-friendly fetch utility with predictable engine fallback.

NPM Downloads License

@renpwn/simplefetch is a core network utility designed to fetch raw data only
without parsing, storage, logging, auto-install, or hidden side-effects.


✨ Features

  • ✅ Minimal & predictable
  • ✅ Multiple fetch engines
  • ✅ Auto fallback mode
  • ✅ Optional retry & timeout
  • ✅ Abort / cancel support
  • ✅ Observability hook
  • ✅ Structured error system
  • ✅ TypeScript typings included
  • ❌ No auto-install dependency
  • ❌ No logging
  • ❌ No file system write
  • ❌ No domain logic
  • ❌ No hidden side-effects

📦 Installation

npm i @renpwn/simplefetch

Optional engines

# Cookie / session support (native fetch)
npm i tough-cookie

# Cookie / session support (axios)
npm i axios-cookiejar-support tough-cookie

# JavaScript-rendered pages
npm i puppeteer

🚀 Basic Usage

import { simpleFetch } from "@renpwn/simplefetch"

const html = await simpleFetch("https://example.com")
console.log(html)

⚙️ Engines & Node.js Compatibility

| Engine | Description | Dependency | Minimum Node.js | |------|------------|------------|-----------------| | native | Node.js built-in fetch (Undici) | none | ≥ 18 | | nativeCookie | Native fetch with cookie / session support | tough-cookie | ≥ 18 | | axios | Axios HTTP client | axios | ≥ 14 | | axiosCookie | Axios with cookie / session support | axios-cookiejar-support, tough-cookie | ≥ 14 | | puppeteer | JavaScript-rendered pages | puppeteer | ≥ 16 |


🔁 Engine Modes

Explicit engine

await simpleFetch(url, { engine: "axios" })
  • No fallback
  • Missing dependency → throws error
  • Unsupported runtime → throws error

Auto mode (default)

await simpleFetch(url)

Fallback order:

native → nativeCookie → axios → axiosCookie → puppeteer

Behavior:

  • Missing dependency → skipped
  • First success → returned
  • All fail → error thrown

🔄 Retry Policy

| Mode | Default retry | |------|---------------| | Explicit engine | 0 | | Auto mode | 1 per engine |

await simpleFetch(url, { retries: 2 })

Retry applies only to runtime errors, not to missing dependencies or invalid config.


⏱ Timeout (Optional)

await simpleFetch(url, { timeout: 15000 })

If not set, engine default timeout is used.


📤 Output Modes

| Output | Return type | |------|-------------| | text (default) | string | | json | object | | buffer | Buffer | | stream | ReadableStream |

Example:

const data = await simpleFetch(url, { output: "json" })

🛑 Abort / Cancel

const controller = new AbortController()

simpleFetch(url, {
  signal: controller.signal
})

controller.abort()

Useful for batch jobs, CLI tools, and long-running requests.


🔍 Observability Hook

simpleFetch(url, {
  onAttempt({ engine, attempt }) {
    console.log(engine, attempt)
  }
})

Called every time an engine is attempted.


❌ Error Handling

Return contract

  • ✅ Success → returns data
  • ❌ Error → throws error

No:

  • { success: true }
  • null
  • silent failure
  • internal logging

Error Types

import {
  EngineNotAvailableError,
  InvalidEngineError,
  AllEnginesFailedError
} from "@renpwn/simplefetch"

🧠 Design Principles

  • Single responsibility
  • Fail fast
  • No side-effects
  • No magic behavior
  • User owns logging & persistence

🧩 Recommended Architecture

simplefetch  → fetch raw data
processor    → parse / transform
writer       → save / export

📘 TypeScript Support

Type definitions are included (index.d.ts).
No build step required.


🛡 Production & CI Safe

  • No auto-install
  • No console output
  • No file write
  • No environment mutation

Safe for:

  • Production servers
  • CI pipelines
  • CLI tools
  • Libraries

📄 License

MIT © renpwn - Ardy Rendra R


🙌 Support the Author

If this project helps you or saves you time, your support is greatly appreciated 🙏

⭐ Star the repo

GitHub Stars

📺 Content & Community

YouTube

🛒 Marketplace & Social Commerce

TikTok Shopee Tokopedia

☕ Personal Support

PayPal Saweria Trakteer