Skip to content

Commit

Permalink
Implement file uploading for Storage Client (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreadatour authored Jan 6, 2025
1 parent 81c774f commit b4239e1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/datachain/client/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,12 @@ def open_object(
self.fs.open(self.get_full_path(file.path, file.version)), cb
) # type: ignore[return-value]

def upload(self, path: str, data: bytes) -> "File":
full_path = self.get_full_path(path)
self.fs.pipe_file(full_path, data)
file_info = self.fs.info(full_path)
return self.info_to_file(file_info, path)

def download(self, file: "File", *, callback: Callback = DEFAULT_CALLBACK) -> None:
sync(get_loop(), functools.partial(self._download, file, callback=callback))

Expand Down

0 comments on commit b4239e1

Please sign in to comment.