Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
An API to download and/or extract git repositories.
This project is the spiritual successor of gittar written in TypeScript.
Since v1.0+
import { download, extract } from 'gitly'
console.log(await download('iwatakeshi/gitly'))
// -> ~/.gitly/github/iwatakeshi/gitly/master.tar.gz
console.log(await download('iwatakeshi/gitly#v1.0.0'))
// -> ~/.gitly/github/iwatakeshi/gitly/v1.0.0.tar.gz
console.log(await download('https://github.com/iwatakeshi/gitly'))
// -> ~/.gitly/github/iwatakeshi/gitly/master.tar.gz
console.log(await download('gitlab:Rich-Harris/buble#v0.15.2'))
// -> ~/.gitly/gitlab/Rich-Harris/buble/v0.15.2.tar.gz
console.log(await download('Rich-Harris/buble', { host: 'gitlab' }))
// -> ~/.gitly/gitlab/Rich-Harris/buble/master.tar.gz
const source = 'path to downloaded zip file (can be obtained by download())'
const destination = '/path/to/foobar'
await extract(source, destination)
// -> /path/to/foobar
Since v2.0+
import gitly from 'gitly'
console.log(await gitly('iwatakeshi/gitly', '/path/to/extracted/folder/'))
// -> ['~/.gitly/github/iwatakeshi/gitly/master.tar.gz', '/path/to/extracted/folder/']
interface GitlyOptions {
/**
* Use cache only (default: undefined)
*/
cache?: boolean
/**
* Use both cache and local (default: undefined)
*/
force?: boolean
/**
* Throw an error when downloading (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
}
/**
* Set the request headers (default: undefined)
*/
headers?: RawAxiosRequestHeaders | AxiosHeaders
/**
* Set the backend (default: undefined)
*
* @example
* ```markdown
* 'axios' - default behavior
* 'git' - use local git installation to clone the repository (allows for cloning private
* repositories as long as the local git installation has access)
* ```
*/
backend?: 'axios' | 'git'
/**
* Set the git options (default: undefined)
*/
git?: {
/**
* Set the depth of the clone (default: 1)
*/
depth?: number
}
}
interface URLInfo {
protocol: string
host: string
hostname: string
hash: string
href: string
path: string
repository: string
owner: string
type: string
}
FAQs
An API to download and/or extract git repositories
The npm package gitly receives a total of 1,615 weekly downloads. As such, gitly popularity was classified as popular.
We found that gitly demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.