Package Exports
- @slimio/github
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@slimio/github) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Github API
Download and (optionaly) extract github repository archive.
Requirements
- Node.js v12 or higher
Getting Started
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm i @slimio/github
# or
$ yarn add @slimio/githubUsage example
const download = require("@slimio/github");
async function main() {
const tarGZPath = await download("SlimIO.is");
console.log(tarGZPath);
}
main().catch(console.error);API
download(repo: String, options?): Promise< String >
Download a given "public" repository ! Return the name of the .tar.gz file (or the name of the extracted directory).
Repository should be formatted like that:
(org|username).repository_fullnameAvailable options are:
| name | type | default | description |
|---|---|---|---|
| branch | string | master | Git branch to download |
| dest | string | process.cwd() |
Tar/Directory destination |
| extract | boolean | false |
Extract .tar.gz file |
| unlink | boolean | true |
Remove .tar.gz file on extraction |
| auth | string | undefined |
Basic Authentication for private repository |
Env
To be able to work on the project, please create a root .env file with these:
GIT_TOKEN=token_hereDependencies
| Name | Refactoring | Security Risk | Usage |
|---|---|---|---|
| @slimio/is | Minor | Low | Type Checker |
| follow-redirects | Minor | Low | HTTP Request with URL redirection support |
| tar-fs | ⚠️Major | High | Extract tar archive |
License
MIT