emersion / go-webdav

A Go library for WebDAV, CalDAV and CardDAV
MIT License
314 stars 66 forks source link

webdav: change FileSystem.Create to give implementations more control #151

Closed DeepDiver1975 closed 4 months ago

DeepDiver1975 commented 4 months ago

The existing interface seems to be driven be the local file system implementation.

For e.g. an S3 implementation of PUT a bit more control over is required. By passing in request.Body into FileSystem.PutFile() the implementation can directly stream the request content to the target or perform chunked/multi-part upload or what ever is necessary ...

emersion commented 4 months ago

Sounds sensible to me. Can we keep the old name of the method though? It feels more consistent with the rest of the method names (which also operate on files without having File in the name, for instance).

DeepDiver1975 commented 4 months ago

The PUT method can also be used to overwrite an existing resource. FileSystem.Create() feels a bit wrong.

emersion commented 4 months ago

os.Create behaves the same way though: it overwrites any previous file.

DeepDiver1975 commented 4 months ago

@emersion done - THX