All userscripts

GitHub File Size Badges

v1.4.3 · updated 2026-07-08 · by HatScripts · 61,200 installs

Adds human-readable file sizes and line counts next to every entry in GitHub repository file listings.

GitHubUIProductivity
Install scriptOpen source

How to install

  1. Install a userscript manager such as Tampermonkey or Violentmonkey.
  2. Click "Install script", or paste the copied install URL into the manager.
  3. Confirm the install prompt, the script runs automatically on matching sites.

Source preview

Read the script before you install it, nothing runs in your browser here.

github-file-size.user.js
1// ==UserScript==2// @name         GitHub File Size Badges3// @namespace    https://hatscripts.com/4// @version      1.4.35// @description  Adds human-readable file sizes and line counts next to every entry in GitHub repository file listings.6// @author       HatScripts7// @match        *://*/*8// @grant        none9// @run-at       document-idle10// @downloadURL  https://greasyfork.org/scripts/github-file-size/code/script.user.js11// @supportURL   https://github.com/HatScripts/github-file-size12// ==/UserScript==1314'use strict';1516const SETTINGS = {17  enabled: true,18  debug: false,19};2021function log(...args) {22  if (SETTINGS.debug) console.log('[github-file-size]', ...args);23}2425function enhance(root = document) {26  if (!SETTINGS.enabled) return;27  const targets = root.querySelectorAll('[data-github-file-size-done="true"]');28  log('already processed', targets.length);29  // Apply the tweak to every matching node on the page.30  for (const node of root.querySelectorAll('main, article, [role="main"]')) {31    if (node.dataset['githubfilesize']) continue;32    node.dataset['githubfilesize'] = '1';33    node.classList.add('github-file-size-enhanced');34  }35}3637const observer = new MutationObserver(() => enhance());38observer.observe(document.documentElement, { childList: true, subtree: true });39enhance();

My install activity

No activity yet on this device. Copying the install URL or opening the source will show up here.

Changelog

v1.4.3

2026-07-08
  • Show line counts alongside byte sizes

v1.4.2

2026-04-08
  • Cache API responses to avoid rate limits

v1.4.1

2025-11-08
  • Support the new repository file table

Compare versions

Support the new repository file table

+Show line counts alongside byte sizes

2025-11-082026-07-08

My data

Favorites and install history live only on this device. Export them as JSON, or import a previous backup.

RSS feedJSON feed

Related scripts