gitly
An API to download and/or extract git repositories
Last updated 20 days ago by iwatakeshi .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install gitly 
SYNC missed versions from official npm registry.

gitly

An API to download and/or extract git repositories.

Node CI Version codecov Downloads/week License

This project is the spiritual successor of gittar written in TypeScript.

Usage

import { fetch, extract } = from 'gitly'

console.log(await fetch('iwatakeshi/gitly'))
// -> ~/.gitly/github/iwatakeshi/gitly/master.tar.gz

console.log(await fetch('iwatakeshi/gitly#v1.0.0'))
// -> ~/.gitly/github/iwatakeshi/gitly/v1.0.0.tar.gz

console.log(await fetch('https://github.com/iwatakeshi/gitly'))
// -> ~/.gitly/github/iwatakeshi/gitly/master.tar.gz

console.log(await fetch('gitlab:Rich-Harris/buble#v0.15.2'))
// -> ~/.gitly/gitlab/Rich-Harris/buble/v0.15.2.tar.gz

console.log(await fetch('Rich-Harris/buble', { host: 'gitlab' }))
// -> ~/.gitly/gitlab/Rich-Harris/buble/master.tar.gz

const source = 'path to downloaded zip file (can be obtained by fetch())'
const destination = '/path/to/foobar'

await extract(source, destination)
// -> /path/to/foobar

Options

interface GitlyOptions {
  /**
   * Use cache only (default: undefined)
   */
  cache?: boolean
  /**
   * Use both cache and local (default: undefined)
   */
  force?: boolean
  /**
   * Throw an error when fetching (default: undefined)
   */
  throw?: boolean
  /**
   * Set cache directory (default: '~/.gitly')
   */
  temp?: string
  /**
   * Set the host name (default: undefined)
   */
  host?: string
  url?: {
    /**
     * Extend the url filtering method
     * @param info The URLInfo object
     */
    filter?(info: URLInfo): string
  }
  extract?: {
    /**
     * Extend the extract filtering method for the 'tar' library
     */
    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
}

Current Tags

  • 1.1.5                                ...           latest (20 days ago)
  • 1.1.0-0                                ...           next (5 months ago)

13 Versions

  • 1.1.5                                ...           20 days ago
  • 1.1.4                                ...           20 days ago
  • 1.1.3                                ...           3 months ago
  • 1.1.1                                ...           4 months ago
  • 1.1.0                                ...           4 months ago
  • 1.1.0-0                                ...           5 months ago
  • 1.0.6                                ...           5 months ago
  • 1.0.5                                ...           5 months ago
  • 1.0.4                                ...           5 months ago
  • 1.0.3                                ...           5 months ago
  • 1.0.2                                ...           5 months ago
  • 1.0.1                                ...           5 months ago
  • 1.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 13
This Month 13
Last Day 0
Last Week 0
Last Month 22
Dependencies (2)
Dev Dependencies (10)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |