4 ms·
> I don't want to use sqlite. Why not? If you read this page here: https://sqlite.org/appfileformat.html https://sqlite.org/appfileformat.html You'll find t
by pwg 5y ago
> I don't want to use sqlite.
Why not? If you read this page here:
https://sqlite.org/appfileformat.html https://sqlite.org/appfileformat.html
You'll find that your requirement of "internally be a directory" can be done using Sqlite with this one, single, simple table:
CREATE TABLE files(filename TEXT PRIMARY KEY, content BLOB);
I.e., you do not have to create a traditional relational DB schema if you do not want to do so. Of course, if you later do want to add additional relational data, if you are already using Sqlite then doing so becomes trivial.
Plus you mention "cross platform macOS bundles", Sqlite provides cross platform compatibility automatically (even to Linux or Windows platforms).
And, presumably, your focus is on the desktop app rather than a file format. Using Sqlite then removes your need to distract your focus to a file format.
- adamnemecek 5y agoSQLite does too much copying. I might have large binary assets and copying back and forth sounds terrible.
- pwg 5y agoAnd how is your custom format going to avoid copying? If you use the standard open()/[read()|write()]/close() then every read() or write() is a copy operation. Either copying from memory out to storage, or copying from storage into memory. If you instead mmap() the data then the copying is just hidden behind the VM page swapping routines in the kernel. But ultimately there will be a copy from storage into memory or a copy from memory into storage. And, have you bench-marked using Sqlite (in the simple form presented in the web page linked to above) to know whether the copying is an issue? If you have not bench-marked it, then you are just going on assumptions, and assumptions often have a very high probability of being wrong.