Refactor: extract a shared RIFF magic-byte helper
Beta tool for embedding and verifying digital authenticity in images,
Status: Beta
Brought to you by:
redosan
Originally created by: Redo-San
Three near-identical RIFF validators are duplicated across two files. They all check RIFF at offset 0..3 and a fourcc at offset 8..11; only four bytes differ.
Style/shared_validation.js:95-111 (image/webp), :128-144 (audio/wav), :158-174 (video/avi)cli/utils.js:483-499, :519-535, :549-565Introduce one isRiffContainer(buf, fourcc) helper in each module and replace the three copies, removing ~50 duplicated lines.
node --test cli/tests/validation_test.js passes (covers WebP/WAV/AVI at cli/tests/validation_test.js:821-905).node --test cli/tests/cli_utils_test.js passes (covers checkMagicBytes for webp/wav/mp4/avi at cli/tests/cli_utils_test.js:59-163).npm run lint passes.