# sindresorhus/is-jpg architecture

> Architecture diagram of the GitHub repository sindresorhus/is-jpg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sindresorhus/is-jpg
- Repository: https://github.com/sindresorhus/is-jpg

## Overview

is-jpg is a tiny JPEG-signature checker. A caller supplies a Buffer or Uint8Array; the exported function rejects inputs shorter than three bytes and otherwise checks the first three bytes for the JPEG signature, returning a boolean. The graph covers only this runtime behavior; it does not include tests or development tooling.

Main entry points: [`index.js`](https://github.com/sindresorhus/is-jpg/blob/main/index.js) (JPEG checker)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Caller"))
node_checker["JPEG checker<br/>[index.js]"]
node_boolean["Boolean result"]

node_caller -->|"supplies bytes"| node_checker
node_checker -->|"returns result"| node_boolean

click node_checker "https://github.com/sindresorhus/is-jpg/blob/main/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_boolean toneIndigo
class node_checker toneTeal
```

## Components

### Other components

- **Caller**
- [JPEG checker](https://github.com/sindresorhus/is-jpg/blob/main/index.js): `index.js`
- **Boolean result**

## Connections

- Caller → JPEG checker: supplies bytes (evidence: `readme.md`)
- JPEG checker → Boolean result: returns result (evidence: `index.js`)
