Created
August 6, 2010 06:30
-
-
Save volca/510937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import( | |
"compress/flate" | |
"os" | |
"io" | |
) | |
func main(){ | |
inFile,err := os.Open("something.txt",os.O_RDONLY,0666) | |
if err != nil { panic(err.String())} | |
defer inFile.Close() | |
outFile,err := os.Open("compressed.zip", os.O_CREATE | os.O_WRONLY,0666) | |
if err != nil { panic(err.String())} | |
defer inFile.Close() | |
compressor := flate.NewWriter(outFile,flate.BestCompression) | |
defer compressor.Close() | |
_,err = io.Copy(compressor, inFile) | |
if err != nil {panic(err.String())} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment