change reader exmple to show usage of SetPassword

This commit is contained in:
alexmullins 2015-10-29 17:15:39 -05:00
parent 678a885320
commit e7e638f095
1 changed files with 5 additions and 1 deletions

View File

@ -5,12 +5,13 @@
package zip_test package zip_test
import ( import (
"archive/zip"
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"log" "log"
"os" "os"
"github.com/alexmullins/zip"
) )
func ExampleWriter() { func ExampleWriter() {
@ -57,6 +58,9 @@ func ExampleReader() {
// Iterate through the files in the archive, // Iterate through the files in the archive,
// printing some of their contents. // printing some of their contents.
for _, f := range r.File { for _, f := range r.File {
// if f.IsEncrypted() {
// f.SetPassword([]byte("password"))
// }
fmt.Printf("Contents of %s:\n", f.Name) fmt.Printf("Contents of %s:\n", f.Name)
rc, err := f.Open() rc, err := f.Open()
if err != nil { if err != nil {