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

@unireq/http

v1.1.0

Published

HTTP(S) transport and policies for unireq using Node's built-in fetch (undici)

Readme

@unireq/http

npm version License: MIT

HTTP(S) transport for Unireq built on undici, with serializers, parsers, policies, and protocol-specific helpers.

Installation

pnpm add @unireq/http

Quick Start

import { client } from '@unireq/core';
import { http, body, headers, parse } from '@unireq/http';

const api = client(
  http('https://api.example.com'),
  headers({ 'user-agent': 'MyApp/1.0' }),
  parse.json(),
);

// GET request
const user = await api.get('/users/42');

// POST with JSON body
const created = await api.post('/users', body.json({ name: 'Jane' }));

Features

| Category | Symbols | Purpose | | --- | --- | --- | | Transport | http, UndiciConnector | HTTP/1.1 transport with keep-alive, proxies, TLS | | Body serializers | body.json, body.form, body.text, body.multipart | Encode requests with auto Content-Type | | Response parsers | parse.json, parse.text, parse.stream, parse.sse | Decode responses and handle Accept | | Policies | headers, query, timeout, redirectPolicy | Request configuration | | Conditional | etag, lastModified, conditional | ETag/Last-Modified caching | | Range | range, resume | Partial downloads and resumption | | Rate limiting | rateLimitDelay, parseRetryAfter | Respect Retry-After headers | | Retry | httpRetryPredicate | HTTP-specific retry conditions | | Interceptors | interceptRequest, interceptResponse | Logging/metrics hooks |

Body Serializers

body.json({ name: 'value' });
body.form({ search: 'query', page: 2 });
body.text('plain text');
body.binary(arrayBuffer, 'application/octet-stream');
body.multipart(
  { name: 'file', part: body.binary(buffer, 'application/pdf'), filename: 'doc.pdf' },
  { maxFileSize: 25 * 1024 * 1024, allowedMimeTypes: ['application/pdf'] },
);

Response Parsers & Streaming

const json = await api.get('/data', parse.json());
const text = await api.get('/readme', parse.text());
const stream = await api.get('/file', parse.stream());
const events = await api.get('/events', parse.sse());

for await (const event of events) {
  console.log(event.data);
}

Retry with Rate Limiting

import { client, retry, backoff } from '@unireq/core';
import { http, httpRetryPredicate, rateLimitDelay, parse } from '@unireq/http';

const api = client(
  http('https://api.example.com'),
  retry(
    httpRetryPredicate({ statusCodes: [429, 503] }),
    [rateLimitDelay({ maxWait: 60_000 }), backoff()],
    { tries: 5 },
  ),
  parse.json(),
);

Conditional Requests

import { etag, lastModified } from '@unireq/http';

const cache = new Map();

const api = client(
  http('https://api.example.com'),
  etag({ get: (url) => cache.get(url), set: (url, v) => cache.set(url, v) }),
  parse.json(),
);

Documentation

Full documentation available at unireq.dev

License

MIT