Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit de475f7

Browse files
committed
quick save: Fri Dec 27 13:02:39 MSK 2024
1 parent 1f2070a commit de475f7

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,41 @@ This project allows you to download any folder inside a repo on github.
88

99
You need to have installed latest node, git, npm
1010

11-
## Initialization
11+
## Installation
1212

13-
Execute this:
13+
### From GitHub NPM Registry
14+
15+
1. [Generate `Personal access token (classic)` with `read:packages` scope](https://github.com/settings/tokens/new?description=Install%20packages%20from%20GitHub%20NPM%20registry&scopes=read:packages&default_expires_at=none)
16+
2. Save the token
17+
3. Run `npm login --auth-type=legacy --registry=https://npm.pkg.github.com` (read more about `--auth-type=legacy` [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token))
18+
4. Enter your username when asked
19+
5. Paste the token as password value
20+
6. Then run `npm i @nikelborm/download-github-folder` to install the package
21+
22+
### From default NPM registry
23+
24+
Currently in despute with NPM's support over publishing it as `download-github-folder`
25+
26+
### For local development
1427

1528
```bash
1629
# Clone this repo:
17-
git clone -b main --depth 1 https://github.com/nikelborm/download-github-folder.git
30+
git clone -b main https://github.com/nikelborm/download-github-folder.git
1831
# cd to it:
1932
cd download-github-folder
2033
# Install dependencies:
2134
npm install
2235
# Create .env file:
2336
cp template.env .env
37+
# Ask for token
38+
read -sp 'Enter github access token: ' gh_token; echo;
39+
# And immediately put it into .env
40+
sed -i "s/\(GITHUB_ACCESS_TOKEN\)='.*'/\1='$gh_token'/" .env
2441
```
2542

26-
Then [get personal github access token here](https://github.com/settings/tokens)
27-
2843
## Environment Variables
2944

30-
- `GITHUB_ACCESS_TOKEN`: This is your personal access token from GitHub. It is used to authenticate your requests to the GitHub API. You can generate one from your GitHub account settings.
45+
- `GITHUB_ACCESS_TOKEN`: This is your personal access token from GitHub. It is used to authenticate your requests to the GitHub API. You can generate one [here](https://github.com/settings/tokens/new?description=Read%20repo%20contents%20access%20to%20download-github-folder&scopes=public_repo&default_expires_at=none).
3146
- `GITHUB_REPO_OWNER`: This is the username of the owner of the repository you are trying to download from. For example, if the repository's URL is `https://github.com/apache/superset`, the owner is `apache`.
3247
- `GITHUB_REPO_NAME`: This is the name of the repository you are trying to download from. In the example above, the repository name is `superset`.
3348
- `PATH_TO_DIRECTORY_IN_REPO`: This is the path to the directory you want to download. It can be directory that lies inside root of repo like `docker` or it can be some nested directory like `docker/nginx`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nikelborm/download-github-folder",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"type": "module",
55
"description": "Download any directory at any depth from any repo on GitHub on any git ref",
66
"license": "MIT",

template.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Get here: https://github.com/settings/tokens
1+
# Get here: https://github.com/settings/tokens/new?description=Read%20repo%20contents%20access%20to%20download-github-folder&scopes=public_repo&default_expires_at=none
22
GITHUB_ACCESS_TOKEN='ghp_1234567890abcdefghij'
33

44
GITHUB_REPO_OWNER='apache'

0 commit comments

Comments
 (0)