Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.
/ badged Public archive

Downloads-badge-as-a-service (DbaaS) πŸ“¦ πŸ“ˆ

License

Notifications You must be signed in to change notification settings

HR/badged

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Badged
Badged

Customizable GitHub Release downloads badge service

Downloads Downloads Downloads


A service that provides you with a customizable download count badges for your GitHub Releases. Allows you to keep track of your release downloads and let others know how popular your releases are. Use virtually any badge service (e.g. shields.io) you like! Uses GitHub API, Mongodb 🌱, Koa ⚑ and ES17 ✨. Available for free.

Features

  • Get a shiny downloads badge to add to your projects' README.md
  • Pretty-printed download count
  • Get downloads badge for a specific release by
    • Id
    • Tag
  • Get all-time (total) download count of all your releases
  • Use any badge service of your choice (with any customization offered)
  • Highly scalable service (see Scalability)

Scalability

All downloads are updated at an interval of an hour so as to stay within the GitHub API request limit and increase scalability. Updates are request-driven meaning that download counts are only updated after the interval if the badge is requested. Furthermore, advanced caching is used to ensure only modified data is updated via conditional requests which also reduces API quota usage and increases scalability.

Usage

Using the Badged API is pretty simple, just form the badged link for the desired repo badge and use it as the source of an image element.

HTML

<img src="https://get-badge.herokuapp.com/HR/Crypter" alt="Downloads badge">

Markdown

![Downloads badge](https://get-badge.herokuapp.com/HR/Crypter)

Base url

The base url for all downloads badges is

https://get-badge.herokuapp.com/:username/:repo

Where username and repo are the GitHub username and repository respectively.

Get downloads badge for latest release

https://get-badge.herokuapp.com/:username/:repo

By default, the base url yields a badge for latest release

Get downloads badge for a release by id

https://get-badge.herokuapp.com/:username/:repo/:id

Where id is the GitHub Release id.

Get downloads badge for a release by tag name

https://get-badge.herokuapp.com/:username/:repo/tags/:tag

Where tag is the GitHub Release tag name.

Get downloads badge for all releases

https://get-badge.herokuapp.com/:username/:repo/total

The latest total download count for all releases is calculated when requested.

Specifying a custom badge

By default, the shields.io downloads badge (i.e. https://img.shields.io/badge/downloads-${DOWNLOAD_COUNT}-green.svg) with the calculated download count is sent as the response.

However, you can specify a custom badge URI for any badge via the badge parameter. The badge URI must include the %s substitution character, which badged substitutes with the calculated download count (Pretty-printed), to yield the correct downloads badge. E.g. if the download count is 1293 and the badge URI is https://img.shields.io/badge/downloads-%s-red.svg yields the badge https://img.shields.io/badge/downloads-1,293-red.svg

Examples

  • Downloads badge for the latest release https://get-badge.herokuapp.com/HR/Crypter Crypter
  • Custom downloads badge for the latest release https://get-badge.herokuapp.com/HR/Crypter?badge=https://img.shields.io/badge/downloads-%s-red.svg Crypter
  • Downloads badge for release by id https://get-badge.herokuapp.com/HR/Crypter/5163582 Crypter
  • Downloads badge for release by tag https://get-badge.herokuapp.com/HR/Crypter/tags/v3.0.0 Crypter
  • Downloads badge for all releases https://get-badge.herokuapp.com/HR/Crypter/totalCrypter

License

The MIT License (MIT)

Copyright (c) Habib Rehman (https://git.io/HR)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished todo so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.