GetString is a convenience function to pull an object from this object store and return it as a string.
(ctx context.Context, name string, opts ...GetObjectOpt)
| 1112 | |
| 1113 | // GetString is a convenience function to pull an object from this object store and return it as a string. |
| 1114 | func (obs *obs) GetString(ctx context.Context, name string, opts ...GetObjectOpt) (string, error) { |
| 1115 | result, err := obs.Get(ctx, name, opts...) |
| 1116 | if err != nil { |
| 1117 | return "", err |
| 1118 | } |
| 1119 | defer result.Close() |
| 1120 | |
| 1121 | var b bytes.Buffer |
| 1122 | if _, err := b.ReadFrom(result); err != nil { |
| 1123 | return "", err |
| 1124 | } |
| 1125 | return b.String(), nil |
| 1126 | } |
| 1127 | |
| 1128 | // PutFile is convenience function to put a file into an object store. |
| 1129 | func (obs *obs) PutFile(ctx context.Context, file string) (*ObjectInfo, error) { |