3 ms·
> while not being too burdensome to type Exactly, and nowadays we have fast enough storage that reading the first few bytes of a file isn't a burden either. Mi
by lucb1e 12y ago
> while not being too burdensome to type
Exactly, and nowadays we have fast enough storage that reading the first few bytes of a file isn't a burden either. Might as well do that instead of appending bytes to each filename. Magic mime is more reliable, versatile and arguably safer (.jpg.exe attachments..?).
- DougWebb 12y agoIf I'm bringing up a directory listing, and the GUI tool I'm using is showing me different icons for different file types (or some other type-specific visual distinction), then I don't want it to have to read the first few bytes of every file in the directory. That doesn't scale. The file type needs to be part of the directory listing itself. Traditionally on Windows it's been part of the filename (which typically is only part of the directory listing, and not attached to the file) but it could have been stored as an attribute as well. That would have made more sense, but even NTFS was designed at a time when disk space actually cost something, and a filetype attribute probably would have wound up being a GUID registry key, which is a lot of bytes for every file in a big directory.
- lucb1e 12y agoFair point, and as you mention it could be optimized by using an attribute for magic mime cache. Another optimization is showing only the icons for the files currently in view, which should scale pretty much forever (I can't imagine so many files being in view that this becomes impractical without the view itself being useless). File managers already do this for thumbnails, though that's because they need to read the entire (often megabytes large) image.
- bodyfour 12y agoI wonder if it's really safer. You'd probably find that you'd have different magic databases and a carefully constructed (malicious) document might give different answers. Imagine that your email client decided a document was a PDF, but your file manager thought it was a loadable extension. You're trading one class of vulnerability for another. I'd also argue that the endurance of the file extension is a hint that people may actually like them. Extensions were invented as an affordance to the computer (which it no longer needs) but the information they convey is useful to humans as well. It may be a quirky old convention, but it provides a universally-understood language for describing a file type. Anyway, I think the overall discussion on this submission is a good example of why 3-character extensions survive: some people here argue for longer extensions, others say we should have no extensions, and the silent majority is happy to keep splitting the difference.