# sindresorhus/is-png architecture

> Architecture diagram of the GitHub repository sindresorhus/is-png, 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-png
- Repository: https://github.com/sindresorhus/is-png

## Overview

is-png is a small runtime utility that checks the first eight bytes of a Buffer or Uint8Array against the PNG signature and returns a boolean. Node.js and browser callers supply the bytes; the TypeScript declaration documents the API. The workflow is supported by the README and implementation; no other runtime subsystems are present.

Main entry points: [`index.js`](https://github.com/sindresorhus/is-png/blob/main/index.js) (PNG detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_consumer(("Caller"))
node_detector["PNG detector<br/>[index.js]"]
node_result["Boolean result"]
node_types["Type contract<br/>[index.d.ts]"]

node_consumer -->|"passes bytes"| node_detector
node_detector -->|"returns match"| node_result

click node_detector "https://github.com/sindresorhus/is-png/blob/main/index.js"
click node_types "https://github.com/sindresorhus/is-png/blob/main/index.d.ts"

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_consumer,node_result toneIndigo
class node_detector,node_types toneTeal
```

## Components

### Other components

- **Caller**
- [PNG detector](https://github.com/sindresorhus/is-png/blob/main/index.js): `index.js`
- **Boolean result**
- [Type contract](https://github.com/sindresorhus/is-png/blob/main/index.d.ts): `index.d.ts`

## Connections

- Caller → PNG detector: passes bytes (evidence: `readme.md`)
- PNG detector → Boolean result: returns match (evidence: `index.js`)
