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

finehttp

v0.0.2

Published

The library adds typing and object-oriented approach to http requests.

Readme

FineHTTP

This is a simple library that will help you type standard fetch and automate some actions.

Using

To send a request, simply call the request (or safeRequest) method in the FineHTTP class, passing parameters to it.

const response: IRequestSuccessResult<'json'> = await FineHTTP.request({
    url: 'http://ur.url-or-ip.com',
    method: 'post',
    query: { id: 1, userId: "John" }
})

In the URL you specify the IP or domain of the resource (adding the endpoint if it is a server). Then you specify the http method (standardly get). The query given in the example transforms the request into this form: http://ur.url-or-ip.com?id=1&userId=John

The fundamental difference between safeRequest and request is that safeRequest handles exceptions itself and returns the IRequestExceptionResult interface containing the error. To check which interface was returned, just check response.ok. If true, then SuccessResult, if false, then ExceptionResult

const response: IRequestSuccessResult<'text'> | IRequestExceptionResult = await FineHTTP.safeRequest({
    url: 'http://1.0.0.1',
    responseType: 'text'
})
if (response.ok) {
    /* if it is SuccessQuery */
} else {
    /* or else */
}

Below is a description of all the items in IRequestParams.

url - this is the URL to the resource where you want to send the HTTP request. If it is a server, be sure to specify the endpoint itself

method - http method. For example, post, get, patch, etc.

body - request body. It can include Record, ArrayBuffer, etc. Important: contentType is not set automatically, specify it separately.

contentType - content type, will be specified in the request header automatically

accept - adds an "Accept" header to the request to select the desired content type

headers - here you can list your own headers as a regular paint object

query - automatically append the passed values to the URL. For example, if you specified { name: "Peter", lastName: "Petrov" }, this would be converted to http"//ur_url?name=Peter&lastName=Petrov

responseType - expected response type. Let's say text or json. The return type depends on this.

auth - will add the Authorization header itself

retryCount - number of attempts. Requests will be sent until a correct answer is received or this number of attempts ends. If not specified, there will be one attempt

License

This project is licensed under the Apache License 2.0.
See the LICENSE file for details.