this post was submitted on 19 Aug 2023
641 points (98.8% liked)
Technology
58303 readers
12 users here now
This is a most excellent place for technology news and articles.
Our Rules
- Follow the lemmy.world rules.
- Only tech related content.
- Be excellent to each another!
- Mod approved content bots can post up to 10 articles per day.
- Threads asking for personal tech support may be deleted.
- Politics threads may be removed.
- No memes allowed as posts, OK to post as comments.
- Only approved bots from the list below, to ask if your bot can be added please contact us.
- Check for duplicates before posting, duplicates may be removed
Approved Bots
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
… You can’t edit files inside a zip file. The program’s just hiding that it’s decompressing and decompressing the whole thing every time you change something.
Zip files are usually just another wrapper around DEFLATE, and compressing each block requires knowledge of the previous block’s compression (Part of LZ77). It’s a streaming format, not a sparse format.
RAR != ZIP.
Fell free to read a stack overflow about that situation
Your choices are basically “rewrite the entire file” or “leave the original file in place, do an append and try and hide the old file.”
Editing old data in most streaming file formats with inline metadata is basically impossible because they compact the data as much as possible and internally refer to offsets.
Appending is trivial, editing is very hard if not downright impossible.
If you edit a text file, it actually just creates a new file because inserting text in the middle means all of the text after changes position. I'd still call that editing an existing file rather than creating a new file based on the previous one plus some edits. The second description might be more technically accurate but it's just unnecessary technical details because it's effectively the first description.
Even going back to the original use of edit, editors would mark up books or articles and then a new copy would need to be created with those edits. I'm having trouble thinking of any cases where edit truly means "change something in place without making a new copy of it with the changes included". I guess small edits with pencil or whiteout can sometimes work.