Retrieve the contents of the file at *path* on the *service_name* and write these contents to the provided *file_obj*. Use *retrieveFileFromOffset()* method if you wish to specify the offset to read from the remote *path* and/or the number of bytes to write to the *file_obj*.
(self, service_name, path, file_obj, timeout = 30, show_progress = False, tqdm_kwargs = {})
| 309 | return results[0] |
| 310 | |
| 311 | def retrieveFile(self, service_name, path, file_obj, timeout = 30, show_progress = False, tqdm_kwargs = {}): |
| 312 | """ |
| 313 | Retrieve the contents of the file at *path* on the *service_name* and write these contents to the provided *file_obj*. |
| 314 | |
| 315 | Use *retrieveFileFromOffset()* method if you wish to specify the offset to read from the remote *path* and/or the number of bytes to write to the *file_obj*. |
| 316 | |
| 317 | :param string/unicode service_name: the name of the shared folder for the *path* |
| 318 | :param string/unicode path: Path of the file on the remote server. If the file cannot be opened for reading, an :doc:`OperationFailure<smb_exceptions>` will be raised. |
| 319 | :param file_obj: A file-like object that has a *write* method. Data will be written continuously to *file_obj* until EOF is received from the remote service. In Python3, this file-like object must have a *write* method which accepts a bytes parameter. |
| 320 | :param bool show_progress: If True, a progress bar will be shown to reflect the current file operation progress. |
| 321 | :return: A 2-element tuple of ( file attributes of the file on server, number of bytes written to *file_obj* ). |
| 322 | The file attributes is an integer value made up from a bitwise-OR of *SMB_FILE_ATTRIBUTE_xxx* bits (see smb_constants.py) |
| 323 | """ |
| 324 | return self.retrieveFileFromOffset(service_name, path, file_obj, 0, -1, timeout, show_progress = show_progress, tqdm_kwargs = tqdm_kwargs) |
| 325 | |
| 326 | def retrieveFileFromOffset(self, service_name, path, file_obj, offset = 0, max_length = -1, timeout = 30, show_progress = False, tqdm_kwargs = {}): |
| 327 | """ |
no test coverage detected