@dashlog/fetch-github-repositories
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

Fetch-github-repositories

version Maintenance MIT dep size

Fetch github repositories for a given user (or an organization).

Requirements

Why ?

  • Fast and light (With a lazy API if required).
  • Support both users and orgs endpoints with the kind option.
  • Replacement for repos which introduce dozen of dependencies.
  • TypeScript support.

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @dashlog/fetch-github-repositories
# or
$ yarn add @dashlog/fetch-github-repositories

Usage example

import { fetch, fetchLazy } from "@dashlog/fetch-github-repositories";

const repos = await fetch("fraxken", {
    fetchUserOrgs: true // if you want an equivalent of "repos"
});

// or use lazy API
for await (const repo of fetchLazy("fraxken")) {
    console.log(repo.full_name);
}

API

fetch(namespace: string, options?: FetchOptions): Promise< Repository[] >

Return an Array of repositories (the interface can be found in index.d.ts).

export interface FetchOptions {
  /**
   * @default fetch-github-repo
   */
  agent?: string;
  token?: string | null;
  /**
   * @default users
   */
  kind?: "users" | "orgs";
  /**
   * Fetch the repositories of all orgs for a given user
   * @default false
   */
  fetchUserOrgs?: boolean;
}

fetchLazy(namespace: string, options?: FetchOptions): AsyncIterableIterator< Repository >

Same arguments as fetch.

Contributors

All Contributors

Thanks goes to these wonderful people (emoji key):


Gentilhomme

💻 🐛 📖 🛡️

License

MIT

Dependencies (3)

Dev Dependencies (10)

Package Sidebar

Install

npm i @dashlog/fetch-github-repositories

Weekly Downloads

0

Version

3.0.2

License

MIT

Unpacked Size

13.8 kB

Total Files

9

Last publish

Collaborators

  • pierred
  • fraxken