MCPcopy
hub / github.com/nats-io/nats.go / PutFile

Method PutFile

object.go:884–891  ·  view source on GitHub ↗

PutFile is convenience function to put a file into an object store.

(file string, opts ...ObjectOpt)

Source from the content-addressed store, hash-verified

882
883// PutFile is convenience function to put a file into an object store.
884func (obs *obs) PutFile(file string, opts ...ObjectOpt) (*ObjectInfo, error) {
885 f, err := os.Open(file)
886 if err != nil {
887 return nil, err
888 }
889 defer f.Close()
890 return obs.Put(&ObjectMeta{Name: file}, f, opts...)
891}
892
893// GetFile is a convenience function to pull and object and place in a file.
894func (obs *obs) GetFile(name, file string, opts ...GetObjectOpt) error {

Callers

nothing calls this directly

Calls 2

PutMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected