@dashlog/fetch-github-repositories
v3.0.2
Published
Fetch github repositories for a given user (or organization)
Downloads
12
Readme
Fetch-github-repositories
Fetch github repositories for a given user (or an organization).
Requirements
- Node.js v16 or higher
Why ?
- 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.
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 ✨
Thanks goes to these wonderful people (emoji key):
License
MIT