gitly
An API to download and/or extract git repositories.
This project is the spiritual successor of gittar written in TypeScript.
Usage
Since v1.0+
import { download, extract } from 'gitly'
console.log(await download('iwatakeshi/gitly'))
console.log(await download('iwatakeshi/gitly#v1.0.0'))
console.log(await download('https://github.com/iwatakeshi/gitly'))
console.log(await download('gitlab:Rich-Harris/buble#v0.15.2'))
console.log(await download('Rich-Harris/buble', { host: 'gitlab' }))
const source = 'path to downloaded zip file (can be obtained by download())'
const destination = '/path/to/foobar'
await extract(source, destination)
Since v2.0+
import gitly from 'gitly'
console.log(await gitly('iwatakeshi/gitly', '/path/to/extracted/folder/'))
Options
interface GitlyOptions {
cache?: boolean
force?: boolean
throw?: boolean
temp?: string
host?: string
url?: {
filter?(info: URLInfo): string
}
extract?: {
filter?(path: string, stat: FileStat): boolean
}
}
Interfaces
interface URLInfo {
protocol: string
host: string
hostname: string
hash: string
href: string
path: string
repository: string
owner: string
type: string
}