// ReadObject will read the object name and if tobj has been supplied it will
// be returned populated or an error will have resulted.
ReadObject will read the object name and if tobj has been supplied it will
be returned populated or an error will have resulted.
// ReadObject will read the object name and if tobj has been supplied it will // be returned populated or an error will have resulted .
func (fs *FileStore) ReadObject(name string, gobj interface{}) (err error) {
	path := fs.Basepath + "/" + name
	buf, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	contentType := ""
	ext := filepath.Ext(name)
	if ext != "" {
		ext = ext[1:]
		if ext == "json" {
			contentType = "application/json"
		} else if contentType = mime.TypeByExtension(ext); contentType == "" {
			contentType = http.DetectContentType(buf)
		}
	}
	if contentType == "application/json" {
		if err := json.Unmarshal(buf, &gobj); err != nil {
			return fmt.Errorf("Read: %s ~> %v", name, err)
		}
	}
	return err
}
func ( fs * FileStore ) ReadObject ( name string , gobj interface { } ) ( err error ) { path := fs . Basepath + " " + name buf , err := ioutil . ReadFile ( path ) if err != nil { return err } contentType := " " ext := filepath . Ext ( name ) if ext != " " { ext = ext [ 1 : ] if ext == " " { contentType = " " } else if contentType = mime . TypeByExtension ( ext ) ; contentType == " " { contentType = http . DetectContentType ( buf ) } } if contentType == " " { if err := json . Unmarshal ( buf , & gobj ) ; err != nil { return fmt . Errorf ( " " , name , err ) } } return err }
ReadObject will read the object name and if tobj has been supplied it will
be returned populated or an error will have resulted.
ReadObject will read the object name and if tobj has been supplied it will be returned populated or an error will have resulted .
// If that object is json then unmarshal this json