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

gyoza-git

v1.0.1

Published

A Node server with support for the git http-backend CGI program

Readme

gyoza-git allows serving the git http-backend module with a HTTP server in NodeJS, essentially creating a Git repository server.

| Table of Contents | |-------------------| | Usage | | API |

Usage

This is the page shown upon executing gyoza-git --help:

A Node server with support for the git http-backend CGI program.

Usage: gyoza-git [options]

    -p, --port PORT                 Starts the server with the specified port (2215 by default).
    -d, --directory DIRECTORY       Manually specifies the repositories directory.
    -h, --help                      Show this message

If the -d argument is not specified, a REPOSITORIES_DIRECTORY environment variable will be necessary.`)

If the --port parameter is not specified, the default value (2215) will be chosen.

However, the same cannot be said for --directory, which is mandatory unless specified: basically, if it is not specified, the program will look for a REPOSITORIES_DIRECTORY environment variable.

This will point gyoza-git to the directory where all the available repositories are stored, therefore it is crucial to set an appropriate value correctly.

API

gyoza-git provides an API with a fully featured server managing class and the gyoza-git server app itself.

  • GyozaServer is a basic implementation of a HTTP server. It uses the http module to create a server with the start method, and requires a callback function as parameter constructor that indicates the HTTPHandler that will be created and will manage the HTTP request.

    GyozaServer supports by default several content compressions provided by the zlib module: gzip, brotli and deflate; therefore, it is not necessary to manually decode or encode the returned content, as this will be automatically done by the server in case a Content-Encoding or Accept-Encoding header is found.

    When the HTTPHandler receives a new request, it will be initialized with several protected properties:

    • request: the request object;
    • requestStream: the actual readable stream of the request body. Automatically decoded in case a Content-Encoding header has been sent;
    • response: the response object;
    • responseStream: the actual writable stream of the response body. Automatically encoded in case a Accept-Encoding header has been sent;
    • method: the request method sent by the client;
    • path: the path requested (with the query parameters);
    • headers: the headers sent by the client;
    • remoteAddress: the IP address of the requester.

    All of these are accessible within the HTTPHandler class and its methods, which are responsible for handling the response logic.

    The attach point from GyozaServer to HTTPHandler is the handleRequest method, that will forward requests appropriately based on the method (GET will be forwarded to get, POST will be forwarded to post and so on); all of these methods return 405 Method Not Allowed by default, as well as the handleRequest function in case the requested method is not between the most common HTTP ones.

    To make use of all this, it is necessary to provide a new implementation of the HTTPHandler class to the GyozaServer, so that the methods logic can be overridden. Here is an example:

      const {GyozaServer, HTTPHandler} = require('gyoza-git')
        
      class HelloHTTPHandler extends HTTPHandler {
            
          _get() {
              // _reply(statusCode, body, headers, terminate)
              // Only the statusCode is mandatory.
              // If the body is not a String, it will be parsed as JSON.
              // If terminate is set to false, the responseStream will not be closed.
              _reply(200, 'Hello, World!', {
                  'Content-Type': 'text/plain'
              })
          }
        
      }
        
      new GyozaServer((req, res) => new HelloHTTPHandler(req, res)).start()
  • GyozaGitServer, the implementation of GyozaServer used by the program to serve git-http-backend. Provides a GitHTTPHandler that overrides get, post, put, patch and head by forwarding the requests to git.