New File Format
New File Format
![](https://lemmy.ml/pictrs/image/48ee7377-f559-41a2-ae07-7cd491de97a3.png?format=webp&thumbnail=128)
![](https://lemmy.ml/pictrs/image/48ee7377-f559-41a2-ae07-7cd491de97a3.png?format=webp)
New File Format
There are 3 types of files. Renamed txt, renamed zip, and exe
I'd argue with this, but it seems like image and video file extensions have become a lawless zone with no rules so I don't even think they count.
Looking at you, .webp
Don't forget renamed tar.
Isn't the Windows exe also a renamed zip?
See, ZIP files are strange because unlike most other archive formats, they put the "header" and table of contents at the end, and all of the members (files within the zip file) are listed in that table of contents as offsets relative to the start of the file. There's nothing that says that the first member has to begin at the start of the file, or that they have to be contiguous. This means you can concatenate an arbitrary amount of data at the beginning of a ZIP file (such as an exe that opens its argv[0] as a zip file and extracts it) and it will still be valid. (Fun fact! You can also concatenate up to 64KiB at the end and it will still be valid, after you do some finagling. This means that when a program opens a ZIP file it has to search through the last 64KiB to find the "header" with the table of contents. This is why writing a ZIP parser is really annoying.)
As long as whatever's parsing the .exe doesn't look past the end of its data, and whatever's parsing the .zip doesn't look past the beginning of its data, both can go about their business blissfully unaware of the other's existence. Of course, there's no real reason to concatenate an executable with a zip file that wouldn't access the zip file, but you get the idea.
A common way to package software is to make a self-extracting zip archive in this manner. This is absolutely NOT to say that all .exe files are self extracting .zip archives.
No
Just because you can open it with 7-zip doesn't mean it's a zip file. Some exes are also zip files.
Ah, good ol' Microsoft Office. Taken advantage of their documents being a renamed .zip format to send forbidden attachments to myself via email lol
On the flip side, there's stuff like the Audacity app, that saves each audio project as an SQLite database 😳
Also .jar files. And good ol' winamp skins. And CBZ comics. And EPUB books. And Mozilla extensions. And APK apps. And...
an SQLite database
Genius! Why bother importing and exporting
It used to use project folders, but due to confusion/user error was changed in 3.0.
SQLite is amazing. Shush.
that saves each audio project as an SQLite database 😳
Is this a problem? I thought this would be a normal use case for SQLite.
wait what
Civilisation (forget which) runs on an SQLite DB. I was rather surprised when I discovered this, back then.
Also renamed xml, renamed json and renamed sqlite.
Those sound fancy, I just use renamed txt files.
Amateurs.
I have evolved from using file extensions, and instead, don't use any extension!
I use mime. Because magic bit.
You can just go in Folder View and uncheck "hide known file extensions" to fix that! ;)
SQLite explicitly encourages using it as an on-disk binary format. The format is well-documented and well-supported, backwards compatible (there's been no major version changes since 2004), and the developers have promised to support it at least until the year 2050. It has quick seek times if your data is properly indexed, the SQLite library is distributed as a single C file that you can embed directly into your app, and it's probably the most tested library in the world, with something like 500x more test code than library code.
Unless you're a developer that really understands the intricacies of designing a binary data storage format, it's usually far better to just use SQLite.
Use binwalk on those
Most of Adobe’s formats are just gzipped XML
Microsoft office also is xml
Nothing wrong with that... Most people don't need to reinvent the wheel, and choosing a filename extension meaningful to the particular use case is better then leaving it as .zip
or .db
or whatever.
Totally depends on what the use case is. The biggest problem is that you basically always have to compress and uncompress the file when transferring it. It makes for a good storage format, but a bad format for passing around in ways that need to be constantly read and written.
Plus often we're talking plain text files being zipped and those plain text formats need to be parsed as well. I've written code for systems where we had to do annoying migrations because the serialized format is just so inefficient that it adds up eventually.
When i discovered as a little kid that apk files are actually zips i felt like a detective.
I'm curious, what's wrong with webp?
Smh at least use 7z
zstd
or leave
They both have their use cases. Zstandard is for compression of a stream of data (or a single file), while 7-Zip is actually two parts: A directory structure (like tar) plus a compression algorithm (like LZMA which it uses by default) in a single app.
7-Zip is actually adding zstd support: https://sourceforge.net/p/sevenzip/feature-requests/1580/
I'll gunzip
you to oblivion!
A Donnie Darko deep cut