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

2.0.0 • 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.
  • Come with a bundled TypeScript definition for intellisense.

Getting Started

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

$ npm i fetch-github-repositories
# or 
$ yarn add fetch-github-repositories

Usage example

const { fetch, fetchLazy } = require("fetch-github-repositories");
 
async function main() {
    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);
    }
}
main().catch(console.error);

API

fetch(user: string, options?: Options): Promise< Repository[] >

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

Options:

name default value description
agent "fetch-github-repo" User-Agent header (required by github)
token undefined github token for private repositories
kind "users" can be either users or orgs
fetchUserOrgs fetch users organizations repositories when the kind is equal to users

fetchLazy(user: string, options?: Options): AsyncIterableIterator< Repository >

Same arguments as fetch.

License

MIT

Package Sidebar

Install

npm i fetch-github-repositories

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

9.81 kB

Total Files

5

Last publish

Collaborators

  • fraxken