MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / storeFile

Method storeFile

pager_lib/smb/SMBConnection.py:364–376  ·  view source on GitHub ↗

Store the contents of the *file_obj* at *path* on the *service_name*. If the file already exists on the remote server, it will be truncated and overwritten. :param string/unicode service_name: the name of the shared folder for the *path* :param string/unicode path:

(self, service_name, path, file_obj, timeout = 30, show_progress = False, tqdm_kwargs = {})

Source from the content-addressed store, hash-verified

362 return results[0]
363
364 def storeFile(self, service_name, path, file_obj, timeout = 30, show_progress = False, tqdm_kwargs = {}):
365 """
366 Store the contents of the *file_obj* at *path* on the *service_name*.
367 If the file already exists on the remote server, it will be truncated and overwritten.
368
369 :param string/unicode service_name: the name of the shared folder for the *path*
370 :param string/unicode path: Path of the file on the remote server. If the file at *path* does not exist, it will be created. Otherwise, it will be overwritten.
371 If the *path* refers to a folder or the file cannot be opened for writing, an :doc:`OperationFailure<smb_exceptions>` will be raised.
372 :param file_obj: A file-like object that has a *read* method. Data will read continuously from *file_obj* until EOF. In Python3, this file-like object must have a *read* method which returns a bytes parameter.
373 :param bool show_progress: If True, a progress bar will be shown to reflect the current file operation progress.
374 :return: Number of bytes uploaded
375 """
376 return self.storeFileFromOffset(service_name, path, file_obj, 0, True, timeout, show_progress = show_progress, tqdm_kwargs = tqdm_kwargs)
377
378 def storeFileFromOffset(self, service_name, path, file_obj, offset = 0, truncate = False, timeout = 30, show_progress = False, tqdm_kwargs = {}):
379 """

Callers 1

smb_openMethod · 0.95

Calls 1

storeFileFromOffsetMethod · 0.95

Tested by

no test coverage detected