https://github.com/alexxnb/fetch-repo-dir
Download any directory from repository
https://github.com/alexxnb/fetch-repo-dir
Last synced: 3 months ago
JSON representation
Download any directory from repository
- Host: GitHub
- URL: https://github.com/alexxnb/fetch-repo-dir
- Owner: AlexxNB
- License: mit
- Created: 2019-10-30T07:52:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-10T23:08:10.000Z (about 1 year ago)
- Last Synced: 2025-03-08T20:49:02.238Z (3 months ago)
- Language: JavaScript
- Size: 46.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fetch-repo-dir
Download any directory from repository on GitHub, GitLab or Bitbucket to the specified location. Minimal dependencies, works without *git* or *unzip* in the OS.## Usage
`fetchRepoDir({src:,dir:},{})`
`fetchRepoDir([{src:,dir:},...],{})````javascript
const fetchRepoDir = require('fetch-repo-dir');
...
// this is async function.
try{
//this will copy content of the /templates/default of the repository to the ./template directory
await fetchRepoDir({src:'author/repository/templates/default',dir:'./template'});
}catch(err){
trow new Error(err);
}
...
```## Options
|Option |Default|Description |
|---------------|-------|------------------------------------------------|
|replace | false | Replace or not existing directory |
|onDownloadStart| (archive_url,tmp_archive)=>{}| Run before download archive of repository |
|onDownloadEnd | (archive_url,tmp_archive)=>{}| Run after download archive of repository |
|onUnpackStart | (tmp_archive,tmp_dir)=>{}| Run before unpacking archive in tmp folder |
|onUnpackEnd | (tmp_archive,tmp_dir)=>{}| Run after unpacking archive in tmp folder |
|onCopyStart | (tmp_path,dest_path)=>{}| Run before copy folder from tmp to destination |
|onCopyEnd | (tmp_path,dest_path)=>{}| Run after copy folder from tmp to destination |