{"id":20262142,"url":"https://github.com/kefir500/github-release-stats","last_synced_at":"2025-04-11T01:51:02.503Z","repository":{"id":75737218,"uuid":"382872799","full_name":"kefir500/github-release-stats","owner":"kefir500","description":"Node.js module and CLI for fetching the GitHub release download count and other statistics.","archived":false,"fork":false,"pushed_at":"2021-07-12T13:28:39.000Z","size":53,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T23:05:38.374Z","etag":null,"topics":["downloads","github","release","statistics"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kefir500.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-04T14:31:37.000Z","updated_at":"2023-11-26T11:45:15.000Z","dependencies_parsed_at":"2023-03-29T20:05:30.371Z","dependency_job_id":null,"html_url":"https://github.com/kefir500/github-release-stats","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"b71ca9b15937e8e0c32bbe95be218a2af97c928d"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kefir500%2Fgithub-release-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kefir500%2Fgithub-release-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kefir500%2Fgithub-release-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kefir500%2Fgithub-release-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kefir500","download_url":"https://codeload.github.com/kefir500/github-release-stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328104,"owners_count":21085258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["downloads","github","release","statistics"],"created_at":"2024-11-14T11:28:41.285Z","updated_at":"2025-04-11T01:51:02.497Z","avatar_url":"https://github.com/kefir500.png","language":"TypeScript","readme":"# GitHub Release Stats\n\n[![Build and test](https://github.com/kefir500/github-release-stats/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/kefir500/github-release-stats/actions/workflows/build-and-test.yml)\n[![Codecov](https://codecov.io/gh/kefir500/github-release-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/kefir500/github-release-stats)\n[![NPM](https://img.shields.io/npm/v/github-release-stats)](https://www.npmjs.com/package/github-release-stats)\n[![License](https://img.shields.io/github/license/kefir500/github-release-stats)](https://github.com/kefir500/github-release-stats/blob/master/LICENSE)\n\n## Description\n\n**GitHub Release Stats** is a JavaScript library written in TypeScript\nfor fetching the GitHub release download count and other statistics.\n\nIt can be used in several ways:\n\n- [Command-line tool](#using-as-a-command-line-tool)\n- [Module (Node.js or browser)](#using-as-a-module)\n\nThis library also supports the GitHub API pagination out of the box.\n\n## Usage\n\n### Using as a command-line tool\n\n#### Installation\n\n```sh\nnpm i -g github-release-stats\n```\n\nNow you can run `ghstats` in your command line interpreter.\n\n#### Syntax\n\n```sh\nghstats [owner] [repo] [tag] [options]\nghstats [owner/repo] [tag] [options]\n```\n\n#### Parameters\n\n| Parameter | Description                                                             |\n| --------- | ----------------------------------------------------------------------- |\n| `owner`   | Repository owner. If not present, you will be prompted for the input.   |\n| `repo`    | Repository name. If not present, you will be prompted for the input.    |\n| `tag`     | Release tag name. If not present, prints the total number of downloads. |\n\n#### Options\n\n| Option           | Description\n| ---------------- | ---------------------------------------------------- |\n| `-d`, `--detail` | Print detailed statistics for each release           |\n| `-q`, `--quiet`  | Print only resulting numbers and errors (quiet mode) |\n| `-l`, `--latest` | Print statistics for the latest release              |\n| `-h`, `--help`   | Print help message                                   |\n\n#### Environment Variables\n\n| Environment Variable | Description                                            |\n| -------------------- | ------------------------------------------------------ |\n| `GITHUB_TOKEN`       | GitHub personal access token. [Read more](#api-limits) |\n\n#### Examples\n\n```sh\nghstats atom atom            # Print download count for all releases.\nghstats atom/atom            # Print download count for all releases (alt. syntax).\nghstats atom atom -q         # Quiet mode (print only numerical result or errors).\nghstats atom atom -d         # Print detailed description for each release.\nghstats atom atom -l         # Print download count for the latest release.\nghstats atom atom -l -q      # Print download count for the latest release (quiet mode).\nghstats atom atom -l -d      # Print detailed description for the latest release.\nghstats atom atom v1.0.0     # Print download count for the the \"v1.0.0\" release.\nghstats atom atom v1.0.0 -q  # Print download count for the the \"v1.0.0\" release (quiet mode).\nghstats atom atom v1.0.0 -d  # Print detailed description for the \"v1.0.0\" release.\nghstats                      # Get repository owner and name from the user input.\nghstats -h                   # Print help message.\n```\n\n### Using as a Module\n\nYou can use this library in both Node.js and browser environments.\nIn the latter case, you can use bundlers such as Webpack and Parcel.\n\n#### Installation\n\n```sh\nnpm i github-release-stats\n```\n\n#### Constructor\n\n```ts\nGithubStats(repoOwner: string, repoName: string, token?: string)\n```\n\n| Parameter   | Description                                            | Required |\n| ----------- | ------------------------------------------------------ | -------- |\n| `repoOwner` | Repository owner                                       | Yes      |\n| `repoName`  | Repository name                                        | Yes      |\n| `token`     | GitHub personal access token. [Read more](#api-limits) | No       |\n\n#### Methods\n\n| Method                             | Description                                                               | Returns                    |\n| ---------------------------------- | ------------------------------------------------------------------------- | -------------------------- |\n| `getAllReleases()`                 | Fetch all releases                                                        | `Promise\u003cGithubRelease[]\u003e` |\n| `getLatestRelease()`               | Fetch the latest release                                                  | `Promise\u003cGithubRelease\u003e`   |\n| `getRelease(tag: string)`          | Fetch a single release by the specified `tag`                             | `Promise\u003cGithubRelease\u003e`   |\n| `getTotalDownloads()`              | Fetch the total number of release downloads for the whole repo            | `Promise\u003cnumber\u003e`          |\n| `getLatestReleaseDownloads()`      | Fetch the number of downloads for the latest release                      | `Promise\u003cnumber\u003e`          |\n| `getReleaseDownloads(tag: string)` | Fetch the number of downloads for a single release by the specified `tag` | `Promise\u003cnumber\u003e`          |\n\nExample of a `GithubRelease` object:\nhttps://api.github.com/repos/atom/atom/releases/latest\n\n#### Example\n\n```js\n// ES Module:\nimport { GithubStats } from 'github-release-stats';\n\n// CommonJS Module:\nconst { GithubStats } = require('github-release-stats');\n```\n\n```js\nconst gh = new GithubStats('atom', 'atom');\n\ngh.getTotalDownloads().then(count =\u003e {\n  console.log('Total downloads: ' + count);\n}).catch(error =\u003e {\n  console.error(error.message);\n});\n```\n\n## API Limits\n\nBy default, GitHub API allows you to make up to 60 requests per hour.\nYou can increase this limit by specifying your personal access token\nwhich can be created [here](https://github.com/settings/tokens).\n\n- Store your token in the `GITHUB_TOKEN` environment variable\n  (works in CLI and Node.js environment)\n- Pass your token to the `GithubStats` constructor\n  (works in Node.js and browser environments)\n\n## License\n\n**MIT License**\n\nYou are free to use, modify, distribute (including commercial purposes)\nas long as you credit the original author and include the\n[license text](https://raw.githubusercontent.com/kefir500/github-release-stats/master/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkefir500%2Fgithub-release-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkefir500%2Fgithub-release-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkefir500%2Fgithub-release-stats/lists"}