MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / Put

Method Put

drivers/sftp/driver.go:111–124  ·  view source on GitHub ↗
(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress)

Source from the content-addressed store, hash-verified

109}
110
111func (d *SFTP) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error {
112 if err := d.clientReconnectOnConnectionError(); err != nil {
113 return err
114 }
115 dstFile, err := d.client.Create(path.Join(dstDir.GetPath(), stream.GetName()))
116 if err != nil {
117 return err
118 }
119 defer func() {
120 _ = dstFile.Close()
121 }()
122 err = utils.CopyWithCtx(ctx, dstFile, driver.NewLimitedUploadStream(ctx, stream), stream.GetSize(), up)
123 return err
124}
125
126func (d *SFTP) GetDetails(ctx context.Context) (*model.StorageDetails, error) {
127 stat, err := d.client.StatVFS(d.RootFolderPath)

Callers

nothing calls this directly

Calls 8

CopyWithCtxFunction · 0.92
NewLimitedUploadStreamFunction · 0.92
CreateMethod · 0.65
GetPathMethod · 0.65
GetNameMethod · 0.65
CloseMethod · 0.65
GetSizeMethod · 0.65

Tested by

no test coverage detected