Reaching Into Archives Β· Lesson 4 Β· Hinglish
🌐 English version β†’

The Field Guide

Poora course ek decision flow, ek cheat sheet, aur do tools jo sab cover karte hain.

Ab aapke paas model hai: index selective extraction ko possible banata hai, streaming/seekable split batata hai kab sasta hai aur kab nahi, aur code in-memory buffer add karta hai. Yeh capstone in sab ko ek field guide mein nichod deta hai jise aap sach mein rakhoge β€” aur ek task se khatam hota hai jo ise pakka kar dega.

Aapka mission Fluency yaani time pressure mein recall. Field guide ka point yeh hai ki aap raat 11 baje 2 GB archive ke saamne answer dobara derive nahi karte β€” aap ek nazar daalte ho, decide karte ho, type karte ho.

Decision flow

Ek archive, ek baar mein ek sawaal:

You have an archive Need the WHOLE thing? yes BULK extract unzip -d Β· tar -xf Β· 7z x no β€” just some files Random-access? (zip / rar) yes β†’ seek no β†’ walk zip / rar β†’ unzip -p Β· unrar p one seek β€” cheap tar / gz β†’ tar -O Β· zcat sequential walk In code β†’ zipfile / tarfile Β· nested zip β†’ BytesIO (no temp file) shelling out to a tool that needs a path (e.g. unrar) β†’ spill to a temp file
Chaar sawaal β€” poora ya hissa, kaun sa family, code mein, pipe ke through β€” course ka har case settle kar dete hain.

Cheat sheet

Har format ke liye teen verbs jo aapko milenge. Ise bookmark karo.

FormatListStream one β†’ stdoutBulk extract
.zipunzip -l a.zipunzip -p a.zip funzip -d out/ a.zip
.rarunrar l a.rarunrar p a.rar funrar x a.rar out/
.tartar -tf a.tartar -xO -f a.tar ftar -xf a.tar -C out/
.tar.gztar -tzf a.tgztar -xzO -f a.tgz ftar -xzf a.tgz -C out/
.gz (ek file)β€”zcat f.gzgunzip f.gz
.7z7z l a.7z7z e -so a.7z f7z x a.7z
any (universal)bsdtar -tf a.*bsdtar -xOf a.* fbsdtar -xf a.*

Do tools jo (lagbhag) sab cover karte hain

Per-format syntax yaad nahi rakhna chahte? Do readers zyadatar formats ko ek interface ke peeche nigal lete hain:

Lesson 2 se yaad rakhne layak catch: ek universal tool bhi format ki physics maanta hai. .tar.gz par bsdtar -tf abhi bhi ek sequential walk hai; ek .zip par abhi bhi ek seek. Ek interface β€” ek cost nahi.

Capstone β€” apne archive mein haath daalo

Yahi hissa skill banata hai. Ise abhi ek real archive par karo (aapki ek BSE zip perfect hai). Har step khatam karte hi us par click karo:

Course win

Aapne shuru kiya tha β€œaapne unhe bina unzip kiye kaise extract kiya?” poochh kar. Ab aap ise thande dimaag se jawaab de sakte ho β€” index, seek, streaming split, in-memory buffer β€” aur kisi bhi .zip, .rar, .tar(.gz), .7z mein teen tareekon se haath daal sakte ho, dekhte hi sasta wala chunte hue. Yahi fluency mission chahta tha.

Recall check β€” sab kuch, interleaved

Yeh chaaron lessons ko jaan-boojh kar mix karta hai β€” interleaving hi saabit karta hai ki knowledge aapki hai, sirf fresh nahi. Har ek ko memory se retrieve karo.

Primary source β€” yeh do rakho

libarchive / bsdtar β€” universal reader; automatic format detection par front page skim karo. Aur 7-Zip command-line manual l / x / e -so ke liye. Saath mein yeh cheat sheet ke peeche ka do-tool kit hain.

Main aapka teacher hoon β€” istemaal karo. Capstone ne error diya, ya timing ne chaunka diya? Jo hua wo paste karo. Aur jab taiyaar ho, mujhse Lesson 5 design karne ko kaho β€” encrypted archives, >4 GB ke liye zip64, ya yeh sab apne backtester ke loader mein wire karna. Direction aap chuno.
← Lesson 3 Β· πŸ“– Glossary πŸŽ‰ Course complete β€” Lesson 5 apne teacher ke saath chuno

Sources

  1. 7-Zip manual β€” -so (write data to stdout) aur command reference (l list, e/x extract).
  2. libarchive β€” bsdtar. β€œOn read, compression and format are always detected automatically, and the same API is used for all formats.” Tar, zip, 7-zip, cpio, iso, aur zyada padhta hai. bsdtar(1) man page bhi dekho.