4 ms·
The magic number isn't about recognizing specific versions. That's just an added benefit if you choose to add that to the magic number. It is to solve the prob
by CrossVR 2y ago
The magic number isn't about recognizing specific versions. That's just an added benefit if you choose to add that to the magic number.
It is to solve the problem of how to build a file manager that can efficiently recognize all the file types in a large folder without relying on file name extensions.
If you don't include a magic number a file manager would need to attempt to parse the file format before it can determine which file type it is.
- CamperBob2 2y agoFilename extensions are pretty useful. They were adopted for very good reasons, and every attempt to hide them, pretend they don't matter, or otherwise make them go away has only made things worse. You still need a way to make it hard to fool people with deceptive extensions, though, and that's where the magic numbers come in.
- ajross 2y ago> The magic number isn't about recognizing specific versions Yes it is, though. Does your file manager want to display Excel files differently from .jar files? They're both different "versions" of the same file format! Phil Katz in 1988 or whatever could have followed the pedantry in the linked article to the letter (he didn't). And it wouldn't have helped the problem at hand one bit.