Store the contents of the *file_obj* at *path* on the *service_name*. :param string/unicode service_name: the name of the shared folder for the *path* :param string/unicode path: Path of the file on the remote server. If the file at *path* does not exist, it will be created
(self, service_name, path, file_obj, offset = 0, truncate = False, timeout = 30, show_progress = False, tqdm_kwargs = {})
| 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 | """ |
| 380 | Store the contents of the *file_obj* at *path* on the *service_name*. |
| 381 | |
| 382 | :param string/unicode service_name: the name of the shared folder for the *path* |
| 383 | :param string/unicode path: Path of the file on the remote server. If the file at *path* does not exist, it will be created. |
| 384 | If the *path* refers to a folder or the file cannot be opened for writing, an :doc:`OperationFailure<smb_exceptions>` will be raised. |
| 385 | :param file_obj: A file-like object that has a *read* method. Data will read continuously from *file_obj* until EOF. |
| 386 | :param offset: Long integer value which specifies the offset in the remote server to start writing. First byte of the file is 0. |
| 387 | :param truncate: Boolean value. If True and the file exists on the remote server, it will be truncated first before writing. Default is False. |
| 388 | :param bool show_progress: If True, a progress bar will be shown to reflect the current file operation progress. |
| 389 | :return: the file position where the next byte will be written. |
| 390 | """ |
| 391 | if not self.sock: |
| 392 | raise NotConnectedError('Not connected to server') |
| 393 | |
| 394 | results = [ ] |
| 395 | |
| 396 | def cb(r): |
| 397 | self.is_busy = False |
| 398 | results.append(r[1]) |
| 399 | |
| 400 | def eb(failure): |
| 401 | self.is_busy = False |
| 402 | raise failure |
| 403 | |
| 404 | self.is_busy = True |
| 405 | try: |
| 406 | self._storeFileFromOffset(service_name, path, file_obj, cb, eb, offset, truncate = truncate, timeout = timeout, show_progress=show_progress, tqdm_kwargs=tqdm_kwargs) |
| 407 | while self.is_busy: |
| 408 | self._pollForNetBIOSPacket(timeout) |
| 409 | finally: |
| 410 | self.is_busy = False |
| 411 | |
| 412 | return results[0] |
| 413 | |
| 414 | def deleteFiles(self, service_name, path_file_pattern, delete_matching_folders = False, timeout = 30): |
| 415 | """ |
no test coverage detected