I want to get size of the original file from a string variable, which is obtained by using a base64 encode file.
package main
import (
"bufio"
"encoding/base64"
"io/ioutil"
"os"
)
func encodeFile(file string) string {
f, err := os.Open(file)
if err != nil {
panic(err)
}
reader := bufio.NewReader(f)
content, _ := ioutil.ReadAll(reader)
encoded := base64.StdEncoding.EncodeToString(content)
return encoded
}
func main() {
datas := encodeFile("/tmp/hello.json")
//how to get file size from datas
}
how to get the file size from datas
? thks.