Menu

I unzipped a 124 GB file with 25 GB of free space
📰

I unzipped a 124 GB file with 25 GB of free space

DEV Community: go·Zubair Bin Shaukat·4 days ago
#lHr3e88P
#devtogo#devto#dev#file#space
Reading 0:00
15s threshold

I had a 124 GB zip that unpacks to 128.6 GB. 7-Zip, WinRAR and Explorer all need space for the zip and the files at the same time, so that's about 253 GB for one archive.

But you only need the zip while the files are coming out. So I wanted to know if you can delete the zip piece by piece while you extract it.

You can. A zip keeps its file list at the end, so you can work backwards. Write out the last file, flush it to disk, note in a small journal that it's done, then cut that file's bytes off the end of the zip. The drive gets the space back and the next file uses it. The zip shrinks while the folder grows.

If the power goes out at any point, either the file is already on disk or its bytes are still in the zip. You never lose both, and the journal says where to continue.

The extractor doing this is hatchzip , a small open source CLI. I added it to Devpit , a terminal app I'm building for Windows dev machines.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.