// FileAdd adds file to the file store
//export FileAdd
FileAdd adds file to the file store
export FileAdd
// FileAdd adds file to the file store // export FileAdd
func FileAdd(e *C.char) *C.char {
	type fileAdd struct {
		Name    string `json:"name"`
		Content string `json:"content"`
	}
	es := C.GoString(e)
	var fa fileAdd
	if err := json.NewDecoder(bytes.NewBufferString(es)).Decode(&fa); err != nil {
		return nil
	}
	f, err := fs.New()
	if err != nil {
		return nil
	}
	defer f.Close()
	if _, err := f.Write([]byte(fa.Content)); err != nil {
		return nil
	}
	id, err := fs.Add(fa.Name, f.Name())
	if err != nil {
		return nil
	}
	return C.CString(id)
}
func FileAdd ( e * C . char ) * C . char { type fileAdd struct { Name string `json:"name"` Content string `json:"content"` } es := C . GoString ( e ) var fa fileAdd if err := json . NewDecoder ( bytes . NewBufferString ( es ) ) . Decode ( & fa ) ; err != nil { return nil } f , err := fs . New ( ) if err != nil { return nil } defer f . Close ( ) if _ , err := f . Write ( [ ] byte ( fa . Content ) ) ; err != nil { return nil } id , err := fs . Add ( fa . Name , f . Name ( ) ) if err != nil { return nil } return C . CString ( id ) }
FileAdd adds file to the file store
export FileAdd
FileAdd adds file to the file store export FileAdd