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

@labyrinthos/http

v0.1.1

Published

Simple library for doing http requests in node and the browser.

Downloads

7

Readme

Labyrinthos HTTP

Simple library for doing http requests in node and the browser.

Installation

Script Tag

<script src="https://cdn.jsdelivr.net/npm/@labyrinthos/http/lib/browser.mjs"></script>

Node

import http from "@labyrinthos/http/node"

Bundled for browser

import http from "@labyrinthos/http"

Browser API

http`<method>`(url)
http`<method>`(options)

http.use(useOptions)

Options

method is the HTTP method to use (get, post, etc.). url is the relative url to fetch. options is an object of options (including the url)

  • url same as the url argument
  • data data to send in its raw form (ex: an object for json or form-encoded)
  • dataType the type of data being sent, default is "json". some types have a built in converter documented below.
  • headers any headers to include with the request. Content-Type will be set automatically if the dataType has a built in converter.
  • query an object with any parameters to send in the query string.
  • credentials fetch credentials option.
  • type response type to parse as. See the fetch Response Instance methods for details.

use & useOptions

The use function returns a new http instance that can be used in the same way as the base http export, but with the configuration given.

useOptions can set a default value for any option in addition to having its own props to setup other parts of the request.

  • baseURL the base URL to use for all requests. Can be either an absolute URL as a string, or a URL object.

Examples

//  urls for the base export are relative to the current page
await http`get`({
    url: "/browser.mjs",
    type: "text"
})

const echo = http.use({ baseURL: "https://echo.axel669.net" })
await echo`get`({
    url: "/",
    query: {
        a: 10,
        b: 12
    }
})

Node API

const local = http({ baseURL: "http://localhost:45067" })
local`<method>`(options)

The node API is nerly identical to the browser API with 2 differences:

  1. All instances need to be initialized using the same call signature as http.use (there is no location object to be the default).
  2. The options accepts an agent property that is a node http agent

Examples

const local = http({ baseURL: "http://localhost:45067" })
const response = await local`get`({
    url: "/browser.mjs",
    type: "text",
})

const echo = http({ baseURL: "https://postman-echo.com/get" })
const echoRes = await echo`get`({
    url: "/",
    query: { a: 10 }
})