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

sioapi

v1.0.2

Published

Module for making API requests

Downloads

10

Readme

SioApi

Navigator module for making API requests and controlling the responses.

Install

  npm install sioapi

Import

Bundle

import SioApi from "sioapi";

CDN

import SioApi from "https://unpkg.com/sioapi";

API

Creates a new SioApi Object.

This module extends SioEvents.

  • Constructor: new SioApi(url).

    |Name|Type|Description| |---|---|---| |url|String|Url of the API, leave blank to use current host.

  • Events: .on(eventName,callback).

    Check SioEvents for more details

    |Event|Fire Time|Data| |---|---|---| |response|Whenever a response from the server is received|Call Object

  • Methods

    • .getService(name).

      Creates a new Service Object to the API url/name

    • .setHeader(name,value).

      Sets a header to be send to every petition on this api.

    • .removeHeader(name).

      Removes a header from the apis

    • [Async] .get(suburl="",options={}) or .get(options={})

      1. If subUrl is setted makes a GET fetch to API.url/subUrl with the options.
      2. If subUrl is not setted makes a GET fetch to API.url with the options. Returns a Call Object.
    • [Async] .post(suburl="", data={}, options={}) or .post(data={}, options={})

      1. If subUrl is setted makes a POST fetch to API.url/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a POST fetch to API.url with the options and the body of data. Returns a Call Object.
    • [Async] .put(suburl="", data={}, options={}) or .put(data={}, options={})

      1. If subUrl is setted makes a PUT fetch to API.url/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a PUT fetch to API.url with the options and the body of data. Returns a Call Object.
    • [Async] .delete(suburl="", data={}, options={}) or .delete(data={}, options={})

      1. If subUrl is setted makes a DELETE fetch to API.url/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a DELETE fetch to API.url with the options and the body of data. Returns a Call Object.

Service

Created from the call of an API.getService(name). This is used as a middleware between the apiurl and the service you're trying to fetch. Example: If API.url="https://example.com/api" A service can be: "users"

  • Constructor: new Service(url="",service="",api=null).

    No documentation because this is not intended to be used directly. Call API.getService() instead.

  • Events: .on(eventName,callback).

    Check SioEvents for more details

    |Event|Fire Time|Data| |---|---|---| |response|Whenever a response from the server is received|Call Object

  • Methods

    • .getService(name).

      Creates a new Service Object to the API url/name

    • .setHeader(name,value).

      Sets a header to be send to every petition on this Service.

    • .removeHeader(name).

      Removes a header from the Service.

    • [Async] .get(suburl="",options={}) or .get(options={})

      This is going to use the headers from the caller API and the headers from the Service.

      1. If subUrl is setted makes a GET fetch to API.url/${this.service}/suburl with the options.
      2. If subUrl is not setted makes a GET fetch to API.url/${this.service} with the options.

      Returns a Call Object.

    • [Async] .post(suburl="", data={}, options={}) or .post(data={}, options={})

      This is going to use the headers from the caller API and the headers from the Service.

      1. If subUrl is setted makes a POST fetch to API.url/${this.service}/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a POST fetch to API.url/${this.service} with the options and the body of data.

      Returns a Call Object.

    • [Async] .put(suburl="", data={}, options={}) or .put(data={}, options={})

      This is going to use the headers from the caller API and the headers from the Service.

      1. If subUrl is setted makes a PUT fetch to API.url/${this.service}/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a PUT fetch to API.url/${this.service} with the options and the body of data.

      Returns a Call Object.

    • [Async] .delete(suburl="", data={}, options={}) or .delete(data={}, options={})

      This is going to use the headers from the caller API and the headers from the Service.

      1. If subUrl is setted makes a DELETE fetch to API.url/${this.service}/subUrl with the options and the body of data.
      2. If subUrl is not setted makes a DELETE fetch to API.url/${this.service} with the options and the body of data.

      Returns a Call Object.

Call

Properties

|Name|Type|Description| |---|---|---| |url|String|The url the request was made. |headers|Object|Object with the headers of the response. |blob|Blob|Blob of the body of the response. |response|Response|A Response Object with a clone of the fetch response. |status|Number|Number status of the response. |ok|String|response.ok |statusText|String|response.statusText. |raw|Any|The computed raw data of the response. |data|Any|The computed prefered type of the response (In case of the response being a json this is an object representation of that JSON).

Events

This fires the events "response" in the Service and in the API listeners. The listeners can change the final properties of this call.