GetString is a convenience function to pull an object from this object store and return it as a string.
(name string, opts ...GetObjectOpt)
| 867 | |
| 868 | // GetString is a convenience function to pull an object from this object store and return it as a string. |
| 869 | func (obs *obs) GetString(name string, opts ...GetObjectOpt) (string, error) { |
| 870 | result, err := obs.Get(name, opts...) |
| 871 | if err != nil { |
| 872 | return _EMPTY_, err |
| 873 | } |
| 874 | defer result.Close() |
| 875 | |
| 876 | var b bytes.Buffer |
| 877 | if _, err := b.ReadFrom(result); err != nil { |
| 878 | return _EMPTY_, err |
| 879 | } |
| 880 | return b.String(), nil |
| 881 | } |
| 882 | |
| 883 | // PutFile is convenience function to put a file into an object store. |
| 884 | func (obs *obs) PutFile(file string, opts ...ObjectOpt) (*ObjectInfo, error) { |