You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+29-12
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# GitHub Folder Tree 🌲
2
2
3
-
**github-folder-tree** is a React custom hook that allows you to fetch and process the contents of a GitHub folder. It retrieves information about the files and subfolders in the specified folder, including their names, file types, download URLs, SHA hashes, sizes, and paths.
3
+
**github-folder-tree** is a React custom hook that allows you to fetch and process the contents of a GitHub folder. It retrieves information about the files and subfolders in the specified folder, including their names, file types, download URLs, SHA hashes, sizes, and paths. In addition, it provides the functionality to download the contents of the folder as a ZIP file and access repository information.
4
4
5
5
## Installation ⬇️
6
6
@@ -25,29 +25,39 @@ import {useGitHubFolderTree} from 'github-folder-tree';
25
25
**repositoryUrl** is the URL of the GitHub repository, and **apiKey** is an optional GitHub API key for authentication.
<button onClick={handleDownloadClick}>Download Folder as ZIP</button>
51
61
{error &&<div>Error: {error}</div>}
52
62
{log &&<div>Log: {log}</div>}
53
63
<table>
@@ -77,7 +87,11 @@ const MyComponent = () => {
77
87
exportdefaultMyComponent;
78
88
```
79
89
80
-
In the above example, **repositoryUrl** is the URL of the GitHub repository, and **apiKey** is an optional GitHub API key for authentication.
90
+
In the above example, **folderUrl** is the URL of the GitHub folder, and **apiKey** is an optional GitHub API key for authentication.
91
+
92
+
To fetch the contents of a GitHub folder, enter the folder URL in the input field and click **Fetch Folder Contents**. The files and their details will be displayed in a table. Any errors or log messages will be shown accordingly.
93
+
94
+
To download the folder as a ZIP file, click the **Download Folder as ZIP** button. The ZIP file will be generated and downloaded.
81
95
82
96
To fetch the contents of the root folder of a repository, use the repository URL in the following format:
83
97
@@ -109,14 +123,14 @@ Note: Make sure to handle any errors and display them appropriately in your Reac
0 commit comments