ngryman / badge-size Goto Github PK
View Code? Open in Web Editor NEW:beers: Displays the size of a given file in your repository.
:beers: Displays the size of a given file in your repository.
Hi, I wonder how does it calculate the size when you point out only one index.js
file?
For example, I have 4 files in repo/master/lib/
a.js //300b
b.js //800b
c.js //400b
index.js // 1b
//index.js
'use strict';
...
var _a = require('./a.js');
var _b = require('./b.js');
var _c = require('./c.js');
...
and the result of http://img.badgesize.io/dummy/repo/master/lib/index.js.svg?compression=gzip
will most likely be 1b instead of total 300 + 800 + 400 + 1.
Am I understand it correctly?
I would love to use this badge service for modules on our internal Github Enterprise. This would obviously mean that the badge service can't pull the file to check the size automatically. However, if the file-size were an optional parameter, then we could still use the service.
We have an npm-script that checks file size of the dist files after a build. We could write this info directly into the README itself as part of the badge URL.
Hi there!
Most people bundle their libraries using tools like Webpack, Parcel or Rollup. All of these remove sourcemap comments as part of the build process, meaning users of a library don't generally "pay" for sourcemap comments. For this reason, I've generally found it more logical to remove sourcemap comments prior to calculating compressed size. Would you be open to stripping those comments out as part of badge-size? In the past I've used strip-json-comments
for this. Cheers!
Your examples show 3.68 kB. Does this means it is around 3,680 bytes? The small k is ambiguous... Traditionally, we use KB for file sizes (except hard disk manufacturers, but they cheat).
Perhaps alternatively you can display as KiB, MiB and so on. This is increasingly popular and people are used to that already.
After the 49eca18 revert, #4 is an issue again. Github's camo or Github's markdown processing is caching image responses. See the badge here: https://github.com/nathancahill/Split.js/ (displays 1.89 kb) and the correct file size: https://badge-size.herokuapp.com/nathancahill/Split.js/master/split.min.js.svg?compression=gzip&label=size (displays 2.05 kb). Was there a reason to return the response instead of proxying?
Previously this works:
https://img.badgesize.io/https://unpkg.com/snarkdown/dist/snarkdown.js.json
It seems that Zeit Now 1.0 has been removed and this no longer works. See example:
When using badge-size
on a site using https
, the browser displays mixed content warning. Would you consider using SSL on the site to avoid this error?
It's pretty easy to do with now. I just deployed it myself in about 2 mins: https://badge-size-mpcfddqqgp.now.sh ๐
See: kentcdodds/glamorous-website#265 for an example
WHOIS search results
Domain Name: badgesize.io
Registry Domain ID: 5cab44e96c4d426babc7588c50d04f88-DONUTS
Registrar WHOIS Server: whois.1api.net
Registrar URL: http://www.1api.net
Updated Date: 2024-03-24T19:09:19Z
Creation Date: 2016-02-09T18:38:33Z
Registry Expiry Date: 2024-02-09T18:38:33Z
Registrar: 1API GmbH
Context: #84 (comment)
This is working:
![](http://img.badgesize.io/unional/color-map/master/dist/color-map.js)
This is not:
![](badge-size-url)
[badge-size-url]: http://img.badgesize.io/unional/color-map/master/dist/color-map.js
would be great to allow to get the filesize when uglified. I have no uglified version in my repo but want to show the size taking uglification into account.
Would be great, if you would support this.
It stopped working: https://img.badgesize.io/https://unpkg.com/constate?style=flat-square
Hi,
I wanted to use a badge for this .zip file on a Github release and I cannot find a way to use your badge-size project.
http://img.badgesize.io/Naereen/kaamelott-soundboard-desktop-app/releases/download/v0.1-alpha/kaamelott-soundboard-linux-x64.zip.svg
http://img.badgesize.io/GitHub.com/Naereen/kaamelott-soundboard-desktop-app/releases/download/v0.1-alpha/kaamelott-soundboard-linux-x64.zip.svg
http://img.badgesize.io/http://GitHub.com/Naereen/kaamelott-soundboard-desktop-app/releases/download/v0.1-alpha/kaamelott-soundboard-linux-x64.zip.svg
http://img.badgesize.io/https://GitHub.com/Naereen/kaamelott-soundboard-desktop-app/releases/download/v0.1-alpha/kaamelott-soundboard-linux-x64.zip.svg
None seem to work for me.
I tried with another file, this image and it's also not working
http://img.badgesize.io/perso.crans.org/besson/_static/.besson.png.svg
http://img.badgesize.io/http://perso.crans.org/besson/_static/.besson.png.svg
Is there something I don't understand, or is it normal that it only works with GitHub file and relative URL? Thanks in advance ๐
ZEIT Now 1.0 is being shut down. As part of this, all ZEIT Now 1.0 Deployments will become inaccessible.
Hello, awesome repo.
You guys deserve more stars.
Could please parse the style
parameter foward, instead of only -brightgreen
?
https://github.com/ngryman/badge-size/blob/master/index.js#L112
I see the readme.md tell only about file size. I wonder if it's can calculate a total of repository size.
I feel this would be a useful feature to keep an eye on file sizes
e.g:
?pass=100000 - will give brightgreen for files under 100kb, red if not
?pass=100000&fail=200000 - will give brightgreen if size < 100kb, yellow if 100kb < size < 200kb, red if size > 200kb
knocked up a quick POC here but probably wouldn't need too much more work.
Awesome job with this btw!
I really like your idea, but my issue is that we don't commit our dist/
files. I was wondering if there was a way to read a file from NPM where the dist/
is published on release?
Consider adding a .json
file format that returns raw json data instead of an image.
This would allow badge rendering services such as https://badgen.net to be used with this service.
/cc @amio
Hello, I see #86 and #84 say that they have been solved, but there are still some problems and they still don't show. Could you please tell me what I wrote wrong.
[![gzip size: JS](https://img.badgesize.io/https://unpkg.com/vxe-table/lib/vxe-table.umd.min.js?compression=gzip&label=gzip%20size:%20JS)](https://unpkg.com/vxe-table/lib/vxe-table.umd.min.js)
Something like http://www.senchalabs.org/connect/limit.html.
I have to find a good threshold.
All the major browsers now support Brotli compression, may you implement support for it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.