# github-get

> Fetch files and list directories from GitHub repositories

Latest version **0.3.1** (published 2015-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install github-get
pnpm add github-get
yarn add github-get
bun add github-get
```

Provides the command `github-get`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2015-09-01 |
| First published | 2015-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Eugene Sharygin |
| Maintainers | eush77 |
| Keywords | github, ls, list, get, download, fetch, api, dir, directory, file, repository |

## Links

- npm: https://www.npmjs.com/package/github-get
- Repository: https://github.com/eush77/github-get
- Issues: https://github.com/eush77/github-get/issues
- npm.io page: https://npm.io/package/github-get

## Dependencies (6)

- [gh-got](https://npm.io/package/gh-got.md) ^1.1.0
- [ls-view](https://npm.io/package/ls-view.md) ^0.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.1.3
- [file-pager](https://npm.io/package/file-pager.md) ^0.1.0
- [help-version](https://npm.io/package/help-version.md) ^0.2.0
- [object.assign](https://npm.io/package/object.assign.md) ^3.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.3.1 (latest) — 2015-09-01
- 0.3.0 — 2015-08-15
- 0.2.3 — 2015-06-10
- 0.2.2 — 2015-06-09
- 0.2.1 — 2015-06-09
- 0.2.0 — 2015-06-03
- 0.1.0 — 2015-06-03

## README

[![npm](https://nodei.co/npm/github-get.png)](https://nodei.co/npm/github-get/)

# github-get

[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david]

Fetches files and lists directories from GitHub repositories. Decodes base64.

[Relevant GitHub API section.][api-section]

[api-section]: https://developer.github.com/v3/repos/contents/#get-contents

[travis]: https://travis-ci.org/eush77/github-get
[travis-badge]: https://travis-ci.org/eush77/github-get.svg
[david]: https://david-dm.org/eush77/github-get
[david-badge]: https://david-dm.org/eush77/github-get.png

## Example

```
$ github-get eush77 github-get
test/
.gitignore
.travis.yml
LICENSE
README.md
cli.js
index.js
package.json
```

```
$ github-get eush77 github-get test/test.js
'use strict';

var test = require('tape'),
    rewire = require('rewire');
# ...
```

## CLI

### `github-get [-l | --long] [--pager] <user> <repo> [<path>]`

Lists directory or cats file contents at `<path>`.

With `--long`, prints full paths instead of relative names.

With `--pager`, shows result in a `$PAGER`. This is not equivalent to `github-get ... | $PAGER`. Instead, the pager gets the file name argument which allows for syntax highlighting (e.g. via `$LESSOPEN` hook).

## API

### `githubGet(owner, repo, [path], [options], callback(err, data, content))`
### `githubGet("owner/repo", [path], [options], callback(err, data, content))`

#### `path`

Path to file in repository. Defaults to `/` (root).

#### `data`

Data returned by GitHub API. Object or array of objects, depending on whether file is a directory.

#### `content`

File contents (array) or directory listing.

#### `options.decode`

Boolean. If enabled, file contents will be decoded. No-op for directories. Defaults to `true`.

#### `options.token`

GitHub token for authentication. Unauthenticated requests to GitHub API are [limited][rate-limiting] to only 60 requests per hour. Generate your token [here][new-token].

[rate-limiting]: https://developer.github.com/v3/#rate-limiting
[new-token]: https://github.com/settings/tokens/new

#### `options.endpoint`

API endpoint to talk to. Defaults to `https://api.github.com/`.

## Related

- [npm-get] — fetch files and list directories from npm packages.

[npm-get]: https://github.com/eush77/npm-get

## Install

```
npm install -g github-get
```

## License

MIT

---
_Source: https://npm.io/package/github-get · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
