forked from mirror/zip
change reader exmple to show usage of SetPassword
This commit is contained in:
parent
678a885320
commit
e7e638f095
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue