Пример #1
0
func (s *apiSvc) postVerifyHumanSize(w http.ResponseWriter, r *http.Request) {
	b, err := ioutil.ReadAll(r.Body)
	if err != nil {
		http.Error(w, "Error reading body"+err.Error(), 500)
		return
	}

	_, err = human.ParseBytes(string(b))
	if err != nil {
		http.Error(w, "Cannot parse size"+err.Error(), 500)
		return
	}
	return
}
Пример #2
0
func (f FolderConfiguration) GetCacheSizeBytes() (int32, error) {
	bytes, err := human.ParseBytes(f.CacheSize)
	return int32(bytes), err
}