Files
file-tools/docs/ARCHITECTURE.md
T
zemion 91dc9bc2f7
Verify / verify (push) Canceled after 0s
Release File Tools 0.2.0
2026-09-02 08:24:07 +02:00

10 lines
1.8 KiB
Markdown

# Architecture
File Tools is a static React/Vite application wrapped in the shared Toolbox shell. Browser `File` handles and small metadata records remain on the main thread. Selection starts an inspection queue with at most three fresh module workers; each worker is terminated on completion, cancellation, timeout, replacement or unmount. Explicit streaming-hash jobs use the same isolated-worker lifecycle.
The worker reads at most 1 MiB from each end for signature, entropy, text and string heuristics. SHA-256 and SHA-512 are updated together in 1 MiB chunks, so hashing does not buffer the complete file. The hex view independently reads one 512-byte window. `file/signatures.ts` contains project-owned evidence heuristics; `file-type` provides broader signature hints; `@noble/hashes` provides incremental hashes.
`file/manifest.ts` sorts by path and emits JSON or spreadsheet-neutralised CSV. Each row carries its own inspection state/error, while JSON also records aggregate inspected, failed, cancelled and pending coverage so an interrupted batch cannot look complete. Duplicate groups start as same-size candidates and become stronger same-hash candidates after explicit hashing; no deletion or mutation follows. Relative worker and asset URLs keep the build relocatable below a nested portal path.
`file/operations.ts` owns the bounded export operations. Rename templates are expanded into a deterministic download plan and passed through the shared collision-safe filename planner before any download. Split uses immutable `Blob.slice` windows and emits a JSON byte-offset manifest; join verifies part count and aggregate size before constructing an ordered Blob. Checksum manifests sort paths and use the conventional escaped GNU sum-file representation. These operations deliberately do not guess which part order, rename semantics, or checksum scope a user intended.