Fetch github repositories for a given user (or an organization).
- Node.js v20 or higher
- Fast and light (With a lazy API if required).
- Support both
users
andorgs
endpoints with the kind option. - Replacement for repos which introduce dozen of dependencies.
- TypeScript support.
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
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);
}
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;
}
Same arguments as fetch.
Thanks goes to these wonderful people (emoji key):
Gentilhomme 💻 🐛 📖 🛡️ |
MIT