Reputation: 103
I have to modify an existing application to support files. The app is a client-portfolio type of app. It's single user and has a simple database to record client visits. The database looks like it's used as in index of records. The records are individual files which I found is a just a zip file with a different extension. All the client interactions / notes are stored in there as json text files.
The change involved is to add support for documents.
I know I can store files in the database and also links to files in the database and the files exist on the disk somewhere...
The client wants (if possible) to retain this single-file that contains everything on the patient.
So, I'm considering creating folders inside the zip file and putting the documents in there.
I know it will work and I'm not expecting them to add lots of files per client but I'm wondering about performance.
Any thoughts?
Upvotes: 0
Views: 260
Reputation: 416121
Lots of the Microsoft Office formats work this way. Change any .docx
or .xlsx
file extension to .zip
and it'll open right up and let you view the xml markup and other resources. The .3mf
3D file format also works this way.
So yes, I think you'll be okay to put your own folder inside this zip file and use it to store your documents. However, I am concerned about performance over time... how much work is involved in opening the zip file just to read a record, now that the size is significantly larger to hold all the documents? I might suggest keeping a separate zip file for your documents library. In this way, you're still limited to just two files rather than many, and you're sure not to cause performance issues for normal records.
IIRC, appending a zip archive can be fairly efficient, but changing, removing, or inserting any content always requires re-writing the entire archive. Additionally, extracting individual files used to require reading the entire archive, but does not anymore. So as long as your users only add files and don't change them often, this should be reasonable.
Upvotes: 1