PutPath puts the data at the path.
(ctx context.Context, writeBucket WriteBucket, path string, data []byte, options ...PutOption)
| 42 | |
| 43 | // PutPath puts the data at the path. |
| 44 | func PutPath(ctx context.Context, writeBucket WriteBucket, path string, data []byte, options ...PutOption) (retErr error) { |
| 45 | writeObjectCloser, err := writeBucket.Put(ctx, path, options...) |
| 46 | if err != nil { |
| 47 | return err |
| 48 | } |
| 49 | defer func() { |
| 50 | retErr = errors.Join(retErr, writeObjectCloser.Close()) |
| 51 | }() |
| 52 | _, err = writeObjectCloser.Write(data) |
| 53 | return err |
| 54 | } |
| 55 | |
| 56 | // ForReadObject gets a ReadObjectCloser at the given path, calls f on it, and then closes the ReadObjectCloser. |
| 57 | func ForReadObject(ctx context.Context, readBucket ReadBucket, path string, f func(ReadObject) error) (retErr error) { |
searching dependent graphs…