• kbotc@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      2
      ·
      1 year ago

      … 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.

        • kbotc@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          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.

      • Buddahriffic@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        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.