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: about 2 months 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T17:23:14.000Z (almost 5 years ago)
- Last Synced: 2024-12-27T17:39:39.954Z (about 2 months 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.
[](https://www.npmjs.com/package/github-archive-stream)

[](http://travis-ci.org/ralphtheninja/github-archive-stream)
[](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