partialzip icon indicating copy to clipboard operation
partialzip copied to clipboard

Partial Implementation of PartialZip in Go

partialzip

GoDoc License

Partial Implementation of PartialZip in Go


Why?

If you need to download a VERY large zip, but you only need some small file from it, this is a nice optimization to allow you to only extract what you need and nothing else. Saving time, bandwidth and space.

Install

go get github.com/blacktop/partialzip

Example

import (
    "fmt"
    "log"

    "github.com/blacktop/partialzip"
)

func main() {
    pzip, err := partialzip.New("https://apple.com/ipsw/download/link")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(pzip.List())

    n, err := pzip.Download("kernelcache.release.iphone11")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("extracting kernelcache.release.iphone11, wrote %d bytes\n", n)
}
extracting "kernelcache.release.iphone11", wrote 17842148 bytes

CLI

Install

Download punzip from releases

Usage

List zipped files

$ punzip list http://updates-http.cdn-apple.com/download/ipsw

NAME                                                         |SIZE
Firmware/                                                    |0 B
...SNIP...
kernelcache.release.iphone11                                 |18 MB
Firmware/all_flash/LLB.d321.RELEASE.im4p.plist               |331 B
048-16246-211.dmg                                            |107 MB
048-15811-213.dmg                                            |106 MB
Firmware/ICE18-1.00.08.Release.bbfw                          |39 MB

Download a file from the remote zip

$ punzip get --path kernelcache.release.iphone11 http://updates-http.cdn-apple.com/download/ipsw

Successfully downloaded "kernelcache.release.iphone11"

Credits

License

MIT Copyright (c) 2018 blacktop