Two files, same name, same size. Must be duplicates, right? I tested that assumption with a real Node.js run, and it failed. Full run in this Short: https://youtu.be/nrhOO58008Y
The test
I made two notes files with the same name and the same size: 1,920 bytes each. If size were a reliable duplicate check, these two would be the same file.
Then I hashed both with SHA-256 in Node.js. The hashes were different. Different hashes mean different content, so the files are not duplicates, even though the name and size match exactly.
Why size is not enough
Size is a count, not a fingerprint. Two files reach the same byte count in endless ways: swap two paragraphs, change a word for a longer one and trim elsewhere, or just have unrelated content that happens to add up the same. A hash reads every byte, so any change, anywhere, changes the result.
That is why real duplicate finders use size only as a first pass.…