Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bn-l/githubextractor
List and download repositories or individual files quickly
https://github.com/bn-l/githubextractor
archive download downloader fast github list repo repository single-file
Last synced: 16 days ago
JSON representation
List and download repositories or individual files quickly
- Host: GitHub
- URL: https://github.com/bn-l/githubextractor
- Owner: bn-l
- License: mit
- Created: 2024-03-26T12:34:34.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-01T05:34:23.000Z (4 months ago)
- Last Synced: 2024-12-04T02:06:06.326Z (about 1 month ago)
- Topics: archive, download, downloader, fast, github, list, repo, repository, single-file
- Language: HTML
- Homepage: https://bn-l.github.io/GithubExtractor/
- Size: 8.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-extractor
List github repositories and download individual files or whole repos conveniently. Faster than clone depth=1 for an entire repo and much faster if you just need a single file. Also works on the [cli](https://github.com/bn-l/GithubExtractorCLI).
[Api Documentation](https://bn-l.github.io/GithubExtractor/api/GithubExtractor/)
# Quickstart
## Install
```bash
npm install github-extractor
```## Usage
### Initialize
```typescript
import githubExtractor from "github-extractor";const ghe = new githubExtractor({
owner: "octocat",
repo: "Spoon-Knife",
// The default: Readme.md is a different file to README.md
caseInsensitive: false,
})
```### List
```typescript
const fullList = await ghe.list();
// List a repo non recursively to only show the top-level items (recursive is true by default):
const topLevel = await ghe.list({ recursive: false });
// Show any conflicts that might arise if downloading to `dest`:
const conflicts = await ghe.list({ dest: "some/path", conflictsOnly: true });
```### Download
```typescript
await ghe.downloadTo({ dest: "some/path" });
```Using `selectedPaths`:
Downloads only the paths in the repo specified. Do not prefix with repo name. It will
stop downloading once it has the file. This can make getting a single file from a large
repo very fast.```typescript
// Save just `boo.jpg`:
await ghe.downloadTo({ dest: "some/path", selectedPaths: ["someFolder/boo.jpg"] });// just the `README.md` file:
await ghe.downloadTo({ dest: "some/path", selectedPaths: ["README.md"] });
```There are more options and they're all documented using jsdoc so will appear in intellisense.
There is also the [api Documentation](https://bn-l.github.io/GithubExtractor/api/GithubExtractor/).