JSPM

  • Created
  • Published
  • Downloads 10446
  • Score
    100M100P100Q126839F
  • License MIT

Download any repository or subdirectory on GitHub with support for Node.js and the CLI

Package Exports

  • go-git-it

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 (go-git-it) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

go-git-it workflow npm

Download any repository or subdirectory on GitHub with support for Node.js and the CLI

npx go-git-it <url> [outputDir]

Sample

# cwd is ~/mydevspace/

npx go-git-it https://github.com/username/repository
# copied remote content to ~/mydevspace/repository

npx go-git-it https://github.com/username/repository/tree/main/folder
# copied remote content to ~/mydevspace/folder

npx go-git-it https://github.com/username/repository/blob/main/folder/README.md
# copied remote content to ~/mydevspace/README.md

The second command argument is the output directory:

npx go-git-it https://github.com/username/repository path/to/outputDir
# copied remote content to path/to/outputDir/repository

Node interface

go-git-it can also run on a Node.js program.

Installation

npm install go-git-it

Usage

const goGitIt = require('go-git-it')

// Assume cwd is ~/mydevspace/

goGitIt('https://github.com/username/repository')
// copied remote content to ~/mydevspace/repository

goGitIt('https://github.com/username/repository/tree/main/folder')
// copied remote content to ~/mydevspace/folder

goGitIt('https://github.com/username/repository/blob/main/folder/README.md')
// copied remote content to ~/mydevspace/README.md

The second parameter is the output path:

const goGitIt = require('go-git-it')

// Assume cwd is ~/mydevspace/

goGitIt('https://github.com/username/repository', 'path/to/outputDir')
// copied remote content to path/to/outputDir/repository

API

goGitIt(url, outputDir?)

url

Type: string

The URL to the path you want to download. If a folder, will download its content as well.

outputDir

Type: string

Custom path to the outputDir (defaults to the working directorya)

License

MIT (c) Cezar Augusto.