github.com/gogf/gf@v1.16.9/.example/os/gres/gres_pack.go (about) 1 package main 2 3 import ( 4 "github.com/gogf/gf/crypto/gaes" 5 "github.com/gogf/gf/os/gfile" 6 "github.com/gogf/gf/os/gres" 7 ) 8 9 var ( 10 CryptoKey = []byte("x76cgqt36i9c863bzmotuf8626dxiwu0") 11 ) 12 13 func main() { 14 binContent, err := gres.Pack("public,config") 15 if err != nil { 16 panic(err) 17 } 18 binContent, err = gaes.Encrypt(binContent, CryptoKey) 19 if err != nil { 20 panic(err) 21 } 22 if err := gfile.PutBytes("data.bin", binContent); err != nil { 23 panic(err) 24 } 25 }