# aman-devcode1/file-splitter architecture

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

- Interactive diagram: https://gitdiagram.com/aman-devcode1/file-splitter
- Repository: https://github.com/aman-devcode1/file-splitter

## Overview

File Splitter is a browser-only tool: a user selects or drops a file, the app identifies its type, offers applicable split modes, validates the requested value, and creates downloadable parts (individually or in a ZIP). Its engines cover byte ranges, structured documents and archives, text lines, image regions, and audio/video time cuts. The graph preserves those documented capabilities; some engine links are based on the registration excerpt, while unsampled implementation details are not inferred.

Main entry points: [`src/core/registry.ts`](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/registry.ts) (Modes and dispatch), [`src/ui/main.ts`](https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts) (Browser interface), [`src/core/duration.ts`](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/duration.ts) (Media duration), [`src/core/audio`](https://github.com/aman-devcode1/file-splitter/tree/main/src/core/audio) (Audio splitting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser app"]
  node_ui["Browser interface<br/>[main.ts]"]
  node_downloads["Part downloads<br/>[main.ts]"]
  node_zipdownload["ZIP download<br/>[main.ts]"]
end

subgraph group_routing["Detection and routing"]
  node_core["Engine registration<br/>[index.ts]"]
  node_detect["File detection<br/>[detect.ts]"]
  node_signatures["Type signatures<br/>[signatures.ts]"]
  node_registry["Modes and dispatch<br/>[registry.ts]"]
end

subgraph group_structured["Structured files"]
  node_documents["Document splitting"]
  node_archives["Archive splitting<br/>[zip-entries.ts]"]
  node_text["Text line splitting<br/>[text-lines.ts]"]
end

subgraph group_media["Media splitting"]
  node_images["Image splitting<br/>[image-split.ts]"]
  node_audio["Audio splitting"]
  node_video["Video splitting"]
  node_duration["Media duration<br/>[duration.ts]"]
end

subgraph group_shared["Shared logic"]
  node_byte["Byte splitting<br/>[byte-split.ts]"]
  node_cutplan["Time cut planning<br/>[cut-plan.ts]"]
  node_estimate["Time estimate<br/>[estimate.ts]"]
end

node_user(("File user"))

node_user -->|"selects file"| node_ui
node_ui -->|"loads engines"| node_core
node_core -->|"registers engines"| node_registry
node_registry -->|"offers modes by type"| node_detect
node_detect -->|"checks signatures"| node_signatures
node_ui -->|"requests split"| node_registry
node_registry -->|"dispatches byte mode"| node_byte
node_registry -->|"dispatches document mode"| node_documents
node_registry -->|"dispatches archive mode"| node_archives
node_registry -->|"dispatches line mode"| node_text
node_registry -->|"dispatches image mode"| node_images
node_registry -->|"dispatches audio mode"| node_audio
node_registry -->|"dispatches video mode"| node_video
node_duration -->|"reads duration"| node_audio
node_duration -->|"reads duration"| node_video
node_audio -->|"plans clip cuts"| node_cutplan
node_video -->|"plans clip cuts"| node_cutplan
node_documents -->|"names parts"| node_byte
node_archives -->|"uses part names"| node_byte
node_ui -.->|"shows duration"| node_duration
node_ui -.->|"shows estimate"| node_estimate
node_ui -->|"downloads parts"| node_downloads
node_downloads -->|"bundles all parts"| node_zipdownload

click node_ui "https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts"
click node_core "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/index.ts"
click node_detect "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/detect/detect.ts"
click node_signatures "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/detect/signatures.ts"
click node_registry "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/registry.ts"
click node_documents "https://github.com/aman-devcode1/file-splitter/tree/main/src/core/documents"
click node_archives "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/archives/zip-entries.ts"
click node_text "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/text/text-lines.ts"
click node_images "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/images/image-split.ts"
click node_audio "https://github.com/aman-devcode1/file-splitter/tree/main/src/core/audio"
click node_video "https://github.com/aman-devcode1/file-splitter/tree/main/src/core/video"
click node_duration "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/duration.ts"
click node_byte "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/shared/byte-split.ts"
click node_cutplan "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/shared/cut-plan.ts"
click node_estimate "https://github.com/aman-devcode1/file-splitter/blob/main/src/core/estimate.ts"
click node_downloads "https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts"
click node_zipdownload "https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.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_ui,node_downloads,node_zipdownload,node_user toneBlue
class node_core,node_detect,node_signatures,node_registry toneAmber
class node_documents,node_archives,node_text toneMint
class node_images,node_audio,node_video,node_duration toneRose
class node_byte,node_cutplan,node_estimate toneIndigo
```

## Components

### Browser app

- [Browser interface](https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts): `src/ui/main.ts`
- [Part downloads](https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts): `src/ui/main.ts`
- [ZIP download](https://github.com/aman-devcode1/file-splitter/blob/main/src/ui/main.ts): `src/ui/main.ts`

### Detection and routing

- [Engine registration](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/index.ts): `src/core/index.ts`
- [File detection](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/detect/detect.ts): `src/core/detect/detect.ts`
- [Type signatures](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/detect/signatures.ts): `src/core/detect/signatures.ts`
- [Modes and dispatch](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/registry.ts): `src/core/registry.ts`

### Structured files

- [Document splitting](https://github.com/aman-devcode1/file-splitter/tree/main/src/core/documents): `src/core/documents`
- [Archive splitting](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/archives/zip-entries.ts): `src/core/archives/zip-entries.ts`
- [Text line splitting](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/text/text-lines.ts): `src/core/text/text-lines.ts`

### Media splitting

- [Image splitting](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/images/image-split.ts): `src/core/images/image-split.ts`
- [Audio splitting](https://github.com/aman-devcode1/file-splitter/tree/main/src/core/audio): `src/core/audio`
- [Video splitting](https://github.com/aman-devcode1/file-splitter/tree/main/src/core/video): `src/core/video`
- [Media duration](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/duration.ts): `src/core/duration.ts`

### Shared logic

- [Byte splitting](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/shared/byte-split.ts): `src/core/shared/byte-split.ts`
- [Time cut planning](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/shared/cut-plan.ts): `src/core/shared/cut-plan.ts`
- [Time estimate](https://github.com/aman-devcode1/file-splitter/blob/main/src/core/estimate.ts): `src/core/estimate.ts`

### Other components

- **File user**

## Connections

- File user → Browser interface: selects file (evidence: `README.md`)
- Browser interface → Engine registration: loads engines (evidence: `src/ui/main.ts`)
- Engine registration → Modes and dispatch: registers engines (evidence: `src/core/index.ts`)
- Modes and dispatch → File detection: offers modes by type (evidence: `README.md`)
- File detection → Type signatures: checks signatures (evidence: `src/core/detect/detect.ts`)
- Browser interface → Modes and dispatch: requests split (evidence: `README.md`)
- Modes and dispatch → Byte splitting: dispatches byte mode (evidence: `src/core/registry.ts`)
- Modes and dispatch → Document splitting: dispatches document mode (evidence: `src/core/index.ts`)
- Modes and dispatch → Archive splitting: dispatches archive mode (evidence: `src/core/index.ts`)
- Modes and dispatch → Text line splitting: dispatches line mode (evidence: `src/core/index.ts`)
- Modes and dispatch → Image splitting: dispatches image mode (evidence: `src/core/index.ts`)
- Modes and dispatch → Audio splitting: dispatches audio mode (evidence: `src/core/index.ts`)
- Modes and dispatch → Video splitting: dispatches video mode (evidence: `src/core/index.ts`)
- Media duration → Audio splitting: reads duration (evidence: `src/core/duration.ts`)
- Media duration → Video splitting: reads duration (evidence: `src/core/duration.ts`)
- Audio splitting → Time cut planning: plans clip cuts (evidence: `src/core/audio/ogg-split.ts`)
- Video splitting → Time cut planning: plans clip cuts (evidence: `src/core/video/media-time.ts`)
- Document splitting → Byte splitting: names parts (evidence: `src/core/documents/docx-paragraphs.ts`)
- Archive splitting → Byte splitting: uses part names (evidence: `src/core/archives/zip-entries.ts`)
- Browser interface → Media duration: shows duration
- Browser interface → Time estimate: shows estimate
- Browser interface → Part downloads: downloads parts (evidence: `README.md`)
- Part downloads → ZIP download: bundles all parts (evidence: `README.md`)
