Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dashlog/fetch-github-repositories
Fetch github repositories for a given user (or organization)
https://github.com/dashlog/fetch-github-repositories
fetch github nodejs repository
Last synced: 23 days ago
JSON representation
Fetch github repositories for a given user (or organization)
- Host: GitHub
- URL: https://github.com/dashlog/fetch-github-repositories
- Owner: dashlog
- License: mit
- Created: 2019-08-03T11:17:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T15:30:41.000Z (about 1 year ago)
- Last Synced: 2024-05-18T19:20:53.937Z (7 months ago)
- Topics: fetch, github, nodejs, repository
- Language: TypeScript
- Homepage:
- Size: 292 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crafted-nodejs - fetch-github-repositories - Fetch github repositories for a given user (or organization) (Packages / HTTP)
README
# Fetch-github-repositories
![version](https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/dashlog/fetch-github-repositories/master/package.json&query=$.version&label=Version)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/dashlog/fetch-github-repositories/commit-activity)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
![size](https://img.shields.io/github/languages/code-size/dashlog/fetch-github-repositories)Fetch github repositories for a given user (or an organization).
## Requirements
- [Node.js](https://nodejs.org/en/) v20 or higher## Why ?
- Fast and light (With a lazy API if required).
- Support both `users` and `orgs` endpoints with the **kind** option.
- Replacement for [repos](https://github.com/jonschlinkert/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](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
```bash
$ npm i @dashlog/fetch-github-repositories
# or
$ yarn add @dashlog/fetch-github-repositories
```## Usage example
```js
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).```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](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
## License
MIT