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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@augu/orchid

v3.1.1

Published

🛬 Simple and lightweight way to create a HTTP request to the world, with more features sprinkled in.

Downloads

126

Readme

@augu/orchid

🛫 Simple and lightweight way to create a HTTP request to the world, with more features sprinkled in.

👉 View other branches: 1.x branch | 2.x branch

Features

  • Middleware: Orchid has a Express-like interface for creating middleware to extend classes like Request, Response, and HttpClient.
  • Serialization: Orchid provides a serialization system to serialize the response body from the Content Type from the server, so far JSON and Text are supported.
  • Path Parameters: Apply path parameters similar to Express routes!
  • Simple: Orchid has a simple API so there is no steep learning curve when moving!

Usage

const { HttpClient, middleware } = require('@augu/orchid');

const orchid = new HttpClient();
orchid
  .use(middleware.logging());

orchid
  .get('https://floofy.dev')
  .then((res) => console.log(res.body()))
  .catch(error => console.error(error));

Install

@augu/orchid requires Node.js v14 or higher to use since it uses ES2020 features like optional chaining (?.)

$ npm install @augu/orchid

Middleware

Orchid allows to have custom middleware to do whatever you want from a request or response. An example would be:

const { MiddlewareType } = require('@augu/orchid');

module.exports = {
  name: 'my.middleware',

  // this is a "MultiMiddleware" type
  types: [MiddlewareType.Request, MiddlewareType.Response],

  init() {
    // called when the middleware is added
  },

  onRequest(req) {
    // called when a request has been made
  },

  onResponse(client, req, res) {
    // called when a response is made
    // `client` and `req` are added to do whatever
  }
};

Serialization

Orchid allows you to serialize your own data without doing it yourself every time you make a request. Currently, this is only limited to Response.body().

An example on building a XML serializer would look like this:

const { Serializer } = require('@augu/orchid');

module.exports = class XMLSerializer extends Serializer {
  constructor() {
    super(/application\/xhtml[+]xml/gi);
  }

  serialize(data) {
    const str = data.toString();
    return someXMLParser(str);
  }
}

Then we inject it into our http client or adding it with orchid#method

// HttpClient
const client = new HttpClient({
  serializers: [new XMLSerializer()]
});

// Method function
orchid.get({
  serializers: [new XMLSerializer()]
});

Migration Guide

v1.0 / v1.1 -> v1.2

All this version really does is add middleware or agent (or both!) to the constructor

new HttpClient([]); // adds middleware only
new HttpClient('my agent'); // adds the agent only
new HttpClient([], 'my agent'); // adds middleware and the agent

v1.2 -> v1.3

Now the HttpClient's constructor is an object like this:

interface HttpClientOptions {
  middleware?: Middleware[]; // add any middleware
  baseUrl?: string; // Use a base URL
  agent?: string; // Adds an agent
}

v1.3 -> v1.4

The HttpClient's constructor is now like:

interface HttpClientOptions {
  middleware?: Middleware[];
  defaults?: DefaultRequestOptions;
  agent?: string;
}
    
interface DefaultRequestOptions {
  followRedirects?: boolean;
  headers?: { [x: string]: any }
  timeout?: number;
  baseUrl?: string;
}

v1.x -> v2.x

Read the migration notes for more information.

v2.x -> v3.x

Read the migration notes for more information.

License

@augu/orchid is released under the MIT License, read here for more information. :heart: