> ## Documentation Index
> Fetch the complete documentation index at: https://docs.37audits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Large Resource Auditor

> Flags page resources (images, scripts, stylesheets, videos, iframes) at or above configurable warning and fail size limits

<Info>
  **Performance Auditor** — flags page resources whose size is at or above a warning limit (500 KB by default) or a fail limit (1000 KB by default), both set per monitored URL.
</Info>

<CardGroup cols={2}>
  <Card title="Performance" icon="zap">
    Oversized assets delay rendering and inflate data transfer, especially on mobile.
  </Card>

  <Card title="Configurable" icon="sliders">
    Both size limits are per-URL preferences, so a media-heavy site can raise them without changing the auditor.
  </Card>
</CardGroup>

This auditor loads the monitored page in a headless browser, collects every resource referenced by `img`, `script`, `link[rel=stylesheet]`, `video` and `iframe` elements, and reports each one whose size is at or above the warning limit: as a warning while it stays below the fail limit, and as a failure once it reaches the fail limit.

## How it works

1. **Threshold check** — before loading anything, the auditor checks that `sizeLimitBytesWarning` is lower than `sizeLimitBytesFail`. When it is not, the audit fails with a single check that names both values, and nothing is measured.
2. **Page loading** — opens the URL with Playwright (Basic auth is honoured) and waits for the `load` event. A page that answers HTTP 403, HTTP 429 or a Cloudflare challenge is reported as blocked; any other HTTP error, or a browser error, ends the audit with an `ERROR`.
3. **Resource discovery** — reads the `src` / `href` of `img`, `script`, `link[rel=stylesheet]`, `video` and `iframe` elements. Relative and protocol-relative URLs are resolved against the final page URL; `data:`, `blob:` and other non-HTTP URLs are skipped.
4. **Size lookup** — sends an HTTP `HEAD` request per resource and reads `Content-Length`. When the answer has no `Content-Length` (chunked or streamed responses) or the `HEAD` fails, a `GET` downloads the body, up to `sizeLimitBytesFail`, and counts its bytes; a download that reaches the limit is reported as "at least" that size. Resources are measured eight at a time, each request limited to 5 seconds. A resource that neither request can size is reported as `INFORMATION`.
5. **Comparison** — every resource whose size is **at or above** `sizeLimitBytesFail` produces one `FAIL` check; every resource **at or above** `sizeLimitBytesWarning` and **below** `sizeLimitBytesFail` produces one `WARNING` check. Each check carries the resource URL, its size and both limits in `data` (`sizeInBytes`, `sizeIsLowerBound`, `sizeLimitBytesWarning`, `sizeLimitBytesFail`).

## Preferences

| Key | Type | Default | Description |
| - | - | - | - |
| `sizeLimitBytesFail` | integer (bytes) | `1024000` (1000 KB) | Resources at or above this size fail the audit. Set it per monitored URL on the **Configuration** tab; plain integer bytes only (for example `1048576` for 1 MB). |
| `sizeLimitBytesWarning` | integer (bytes) | `512000` (500 KB) | Resources at or above this size, and below `sizeLimitBytesFail`, produce a warning. Must be lower than `sizeLimitBytesFail`. |

An invalid value (missing, zero, negative, fractional) makes the auditor fall back to that preference's default and log a warning. A warning limit equal to or above the fail limit is not an invalid value: it makes the audit fail until the thresholds are fixed.

## What it audits

Every row maps to one `checkRule*` method and one `CheckCode`, in the order the auditor runs them.

| CheckCode | Status | When it fires | Recommendation | Why it matters |
| - | - | - | - | - |
| <a id="37A-LargeResourceAuditor-401" />`37A-LargeResourceAuditor-401` | `FAIL` | `sizeLimitBytesWarning` is equal to or above `sizeLimitBytesFail`. Message: `sizeLimitBytesWarning ({warning}) must be lower than sizeLimitBytesFail ({fail}).` | On the auditor's Configuration tab, set `sizeLimitBytesWarning` below `{fail}`, or raise `sizeLimitBytesFail` above `{warning}`. | Until the warning threshold is lower than the fail threshold this audit cannot measure the page, so oversized files that slow it down go unreported. |
| <a id="37A-LargeResourceAuditor-500" />`37A-LargeResourceAuditor-500` | `ERROR` | The page could not be loaded in the browser (browser error, timeout, or an HTTP error status other than a block). Message: `Could not load {url} in the browser: {error}.` | Make sure `{url}` loads in a browser (it answered: `{error}`), then run the audit again. | — |
| <a id="37A-LargeResourceAuditor-100" />`37A-LargeResourceAuditor-100` | `INFORMATION` | Neither `HEAD` (`Content-Length`) nor `GET` could size a resource. Message: `Could not measure the size of {resource}: {problem}.` | Make sure `{resource}` answers a HEAD or GET request within 5 seconds; until then its size is not compared with the `{warning}` warning threshold. | — |
| <a id="37A-LargeResourceAuditor-400" />`37A-LargeResourceAuditor-400` | `FAIL` | A resource is at or above `sizeLimitBytesFail`. Message: `Resource {resource} is {size}, at or above the {fail} fail threshold.` | Compress, resize or lazy-load `{resource}` (`{size}`) to bring it below `{fail}`, or raise `sizeLimitBytesFail` if the size is intentional. | Oversized files delay rendering and waste mobile data, so visitors wait longer and more of them leave before the page loads. |
| <a id="37A-LargeResourceAuditor-300" />`37A-LargeResourceAuditor-300` | `WARNING` | A resource is at or above `sizeLimitBytesWarning` and below `sizeLimitBytesFail`. Message: `Resource {resource} is {size}, at or above the {warning} warning threshold and below the {fail} fail threshold.` | Compress or lazy-load `{resource}` (`{size}`) before it grows past `{fail}`. | Large files add load time on every visit, and visitors on slow mobile connections feel it most. |
| <a id="37A-LargeResourceAuditor-200" />`37A-LargeResourceAuditor-200` | `SUCCESS` | All rules passed. Message: `All {n} measured resources are below {warning}; the largest is {resource} at {size}.` | — | — |
| <a id="37A-LargeResourceAuditor-590" />`37A-LargeResourceAuditor-590` | `ERROR` | The audited page answered HTTP 403, HTTP 429 or a Cloudflare challenge, so 37AuditsBot was blocked before it could read the page. | Allow 37AuditsBot in your firewall or bot protection: allowlist its user agent, or verify its Web Bot Auth signature. See [https://www.37audits.com/bot](https://www.37audits.com/bot). | While 37AuditsBot is blocked this audit cannot look at the site, so problems on it go unreported. |

Sizes are shown in MB with two decimals (`1.20 MB`); a size measured by a download that stopped at the fail limit reads `at least 0.98 MB`.

## Output documentation

| Status | Description | Test logic |
| - | - | - |
| **INFORMATION** | A resource could not be measured | Neither `HEAD` nor `GET` gave its size. Never changes the overall status. |
| **SUCCESS** | No resource reaches the warning limit | Every measured resource is below `sizeLimitBytesWarning`. |
| **WARNING** | One or more resources are large, none too large | At least one size is greater than or equal to `sizeLimitBytesWarning`, and none reaches `sizeLimitBytesFail`; the summary message counts them. |
| **FAIL** | One or more resources are too large, or the thresholds are inconsistent | At least one size is greater than or equal to `sizeLimitBytesFail` (the summary counts the failures and, when present, the warnings), or `sizeLimitBytesWarning` is not lower than `sizeLimitBytesFail`. |
| **ERROR** | The audit could not run | The page could not be loaded (`…-500`) or the site blocked 37AuditsBot (`…-590`). |

## Risks and considerations

### Large assets hurt Core Web Vitals

* Oversized hero images and videos are the most common cause of a slow Largest Contentful Paint.
* Big JavaScript bundles block the main thread and delay interactivity on low-end devices.

### What this auditor does not check

* Resources loaded dynamically after the `load` event (for example by scripts or CSS `url()` references) are not discovered.
* A resource behind a slow server (more than 5 seconds per request) is reported as unmeasured rather than compared with the limits.
* The limits apply to every resource type alike; they do not distinguish a 1 MB video from a 1 MB script.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.