This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
badge-size with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Displays the size of a given file in your repository.
badge-size allows you to display in real time the size of a given file which lives in your repository.
The size is always the one of your last pushed commit.
It is mainly designed for front-end library authors that want to advertise the weight of their builds to their users. But you can use it for any other purpose of course :v:.
It works like any other badge service you may know and it's configurable in the image url itself.
Here is the general pattern of a typical
Relative URL of file on GitHub of any absolute URL if hosted elsewhere.
The format of the GitHub URL is the same as when you browse it in the source explorer, minus
Here is its typical form:
For example if I want to point to this repository
index.js, it would be:
Note that the branch name is mandatory.
Optional image format. By default
svg is used.
Optional compression format to measure. It's useful if you want to advertise the true size your
file would take on the wire, assuming the server has
brotli compression enabled.
Optional text to display in the badge instead of size / gzip size / brotli size.
Optional background color. By default it's
You can specify hexadecimal colors, without the dash (i.e
bada55) or one of the following named
Optional style. By default it's
You can specify one of the following:
Optional size limits in bytes.
Max is a hard limit. Exceeding this will generate a red badge.
If softlimit is provided (in addition to max) and the file size falls within the range of max and softmax, a yellow badge will be generated.
This setting will override the color option in the above two scenarios.
Generated with contributors-faces.
MIT © Nicolas Gryman