https://github.com/gholamrezadar/github-direct-downloader
Want to download a specific folder or a single file from a Github repo without cloning the whole repo?
https://github.com/gholamrezadar/github-direct-downloader
downloader github nextjs
Last synced: about 2 months ago
JSON representation
Want to download a specific folder or a single file from a Github repo without cloning the whole repo?
- Host: GitHub
- URL: https://github.com/gholamrezadar/github-direct-downloader
- Owner: Gholamrezadar
- Created: 2025-08-20T07:29:50.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-20T09:25:52.000Z (10 months ago)
- Last Synced: 2025-09-18T11:01:52.475Z (9 months ago)
- Topics: downloader, github, nextjs
- Language: TypeScript
- Homepage: https://github-direct-downloader.vercel.app
- Size: 281 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Github Direct Downloader
Want to download a specific folder or a single file from a Github repo without cloning the whole repo?
Visit the website: [github-direct-downloader.vercel.app](https://github-direct-downloader.vercel.app)

Make sure to give the repo a star :)
## Research
In case you want to build something similar for whatever reason, here are my foundings:
### Get a list of files
To get a list of files from a repo use this api:
```bash
https://api.github.com/repos/{USER}/{REPO}/git/trees/{BRANCH}\?recursive\=1
```
Example:
```bash
https://api.github.com/repos/Gholamrezadar/GHDcode/git/trees/main\?recursive\=1
```
### Get direct link to a file
```bash
https://raw.githubusercontent.com/{USER}/{REPO}/refs/heads/{BRANCH}/{path/to/file.ext}
```
### Download using curl
To download a file using curl and place it in it's original structure use this command (`--create-dirs` is important)
```bash
curl -L "https://raw.githubusercontent.com/{USER}/{REPO}/refs/heads/{BRANCH}/{path/to/file.ext}" --create-dirs -o "path/to/file.ext"
```
Example:
```bash
curl -L "https://raw.githubusercontent.com/gholamrezadar/ghdcode/refs/heads/main/resources/sample%20copy.txt" --create-dirs -o "resources/sample copy.txt"
```
## Credits
GPT 5, Bolt & Gholamreza Dar 2025
(Frontend mostly done by Bolt with minor tweaks from me)