Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ralphtheninja/github-archive-stream
Stream an archived github repository.
https://github.com/ralphtheninja/github-archive-stream
archive-stream github stream tarball zip
Last synced: 14 days ago
JSON representation
Stream an archived github repository.
- Host: GitHub
- URL: https://github.com/ralphtheninja/github-archive-stream
- Owner: ralphtheninja
- License: mit
- Created: 2016-04-05T22:43:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T17:23:14.000Z (over 4 years ago)
- Last Synced: 2024-10-16T23:22:09.749Z (25 days ago)
- Topics: archive-stream, github, stream, tarball, zip
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-archive-stream
> Streams a `.tar.gz` (or `.zip`) archive from GitHub using the [archive link api](https://developer.github.com/v3/repos/contents/#get-archive-link). It makes two http requests since the first is _always_ a `30x` redirect response.
[![npm](https://img.shields.io/npm/v/github-archive-stream.svg)](https://www.npmjs.com/package/github-archive-stream)
![Node version](https://img.shields.io/node/v/github-archive-stream.svg)
[![build status](http://img.shields.io/travis/ralphtheninja/github-archive-stream.svg?style=flat)](http://travis-ci.org/ralphtheninja/github-archive-stream)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)## Install
```
$ npm i github-archive-stream -S
```## Usage
Stream latest master branch of `ipfs/go-ipfs` to the file `'ipfs.tar.gz'`.
```js
const archive = require('github-archive-stream')
archive('ipfs/go-ipfs').pipe(require('fs').createWriteStream('ipfs.tar.gz'))
```## API
### `const stream = archive(repo|opts)`
Create an archive stream.
Parameter can either be a string or an object. Use the string version to stream an open source archive. For private repositories you need to provide the `opts.auth` property, see below.
Options takes the following properties:
```js
{
repo: 'user/repo', // github repository, required
auth: {
user: 'username', // github user, required if private repo
token: 'agithubtoken' // github token, required if private repo
},
ref: '315ae99', // git ref, defaults to 'master'
format: 'zipball' // archive format, defaults to 'tarball'
}
```## License
MIT