📌  相关文章
📜  golang 解码 base64 文件 - Go 编程语言 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:44:59.507000             🧑  作者: Mango

代码示例1
package main

import (
    "fmt"
    "encoding/base64"
)

var b64 = `TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=`

func main() {
    dec, err := base64.StdEncoding.DecodeString(b64)
    if err != nil {
        panic(err)
    }
    
    //print content or store it into a local file system
    fmt.Println(string(des))

}