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 🙏

© 2024 – Pkg Stats / Ryan Hefner

githulk

v1.7.1

Published

Small but powerful Github client

Downloads

26,614

Readme

Githulk

GitHulk is a developer friendly API client for the Github API. In addition to providing access to Github's official API's it also implements new methods that are either convenience functions or a composition of multiple API calls which will make certain actions easier or more natural.

Installation

This module is released in to the npm registry as githulk:

npm install --save githulk

Usage

The GitHulk module is exposed as a single function (constructor) and can therefor be required as:

'use strict';

var GitHulk = require('githulk');

To initialise a new GitHulk instance simply construct it using:

var githulk = new GitHulk(/* optional options */);

As you've might have noticed from the function call above, it accepts an optional options object. The following options can be provided:

  • url: The API endpoint of the Github API (with trailing slash).
  • maxdelay: Maximum delay for exponential back off.
  • mindelay: Minimum delay for exponential back off.
  • retries: Amount of retries before finally giving up.
  • factor: Exponential back off factor.
  • cache: A cache for conditional lookups.
  • user: A Github username (see Authorization)
  • password: A Github password (see Authorization)
  • token: A oauth token (see Authorization)

Authorization

If no options are supplied your API calls will be severely limited by GitHub and a really low rate limiting of 60 API calls per hour will be in place. In order to authorize the GitHulk instance you can provide it with:

  • token: An oauth token for your application.
  • user, password: The user and password of your account (for basic auth).
  • authorization: A predefined authorization header for each request.

In addition to supplying your authorization details through the constructor of the function we also support them through ENV variables. Set the GITHULK_TOKEN or GITHUB_TOKEN variable with your oauth token and we will use that automatically.

Arguments

All API endpoints follow the same function signature, the order in which they are provided does not matter. The only argument that is optional is the options argument.

  • project: An string that has the username/repo combination.
  • options: An object with additional configuration for the API method.
  • fn: An function which is called with an error first callback pattern.

The following API endpoints are implemented, they are currently implemented on a need to have basis:

.repository

  • githulk.repository.contents
  • githulk.repository.readme
  • githulk.repository.raw
  • githulk.repository.moved

License

MIT