Download directory or file from GitHub.
npm i down-git
# yarn add down-git
# pnpm add down-git
The following command downloads the directory https://github.com/holazz/down-git/tree/main/src
into the ./tmp
folder
down-git holazz/down-git/src -b main -o ./tmp
Use
down-git --help
for more information
You can also use it programmatically:
import { download } from 'down-git'
const options = {
route: 'holazz/down-git/src',
branch: 'main',
output: './tmp',
}
download(options).then(
() => console.log('Done!')
)
name | required | description | default |
---|---|---|---|
route |
true | Directory or file path (owner/repo/path) | - |
branch |
false | The name of the commit/branch/tag | Repository's default branch (usually main or master ) |
output |
false | Output directory | process.cwd() |
token |
false | Personal access token | - |