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

@peron_js/web-cli

v2.4.1

Published

A CLI to search and fetch the web

Readme

@peron_js/web-cli

npm

A CLI to search and fetch the web.

Install

bun install -g @peron_js/web-cli

Usage

web search <query>           # search the web for a query (20 results)
web search --pages 6 <query> # fetch 6 pages of 20, i.e. all 120 results
web fetch <url>              # fetch a URL and print its main content as Markdown
web fetch --render <url>     # render it in a headless browser (slow; for JavaScript-only pages)

fetch requests the URL directly with browser navigation headers. Pass --render to load the page through Kitesurf, a headless browser on Cloudflare Workers, so client-side rendered pages work — the fetched URL is sent to that service. See docs/kitesurf-api.md for the rendering API.

search talks to Google's Custom Search Engine endpoint directly, so it needs no API key and no third-party search instance in between.

search and fetch honor the HTTP_PROXY / HTTPS_PROXY / NO_PROXY environment variables.

Run web --help or web <command> --help for details.

Library

import { fetchContent, formatSearchResults, search } from "@peron_js/web-cli";

const results = await search("bun workspaces", { pages: 2 });
console.log(formatSearchResults(results));
const page = await fetchContent(results[0].url, { render: true });
if (page.type === "text") console.log(page.text);

fetchContent() returns web pages as Markdown, other text as is, and images as { type: "image", data, mimeType }. Neither function prints, so they can be embedded in other tools — see @peron_js/web-pi. Every request function takes an optional last argument with an AbortSignal and a fetch implementation; without one it uses the global fetch. For example, to honor proxy variables:

import { EnvHttpProxyAgent, fetch } from "undici";

const dispatcher = new EnvHttpProxyAgent();
await search("bun workspaces", { pages: 2 }, {
  fetch: (url, init) => fetch(url, { ...init, dispatcher }),
  signal: AbortSignal.timeout(10_000),
});

fetchContent() also takes htmlToMarkdown and pdfToMarkdown converters in that argument. Web pages default to the exported built-in htmlToMarkdown; PDFs are rejected unless pdfToMarkdown is given. For example, on Cloudflare Workers with an AI binding:

const toMarkdown = async (name: string, blob: Blob) => {
  const result = await env.AI.toMarkdown({ name, blob });
  if (result.format === "error") throw new Error(result.error);
  return result.data;
};

await fetchContent(url, {}, {
  htmlToMarkdown: (html) => toMarkdown("page.html", new Blob([html], { type: "text/html" })),
  pdfToMarkdown: (pdf) => toMarkdown("doc.pdf", new Blob([pdf], { type: "application/pdf" })),
});