Fetch-github-repositories
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
$ yarn add @dashlog/fetch-github-repositories
Usage example
import { fetch, fetchLazy } from "@dashlog/fetch-github-repositories";
const repos = await fetch("fraxken", {
fetchUserOrgs: true
});
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 {
agent?: string;
token?: string | null;
kind?: "users" | "orgs";
fetchUserOrgs?: boolean;
}
fetchLazy(namespace: string, options?: FetchOptions): AsyncIterableIterator< Repository >
Same arguments as fetch.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
License
MIT