diff options
Diffstat (limited to 'paramiko/sftp_file.py')
-rw-r--r-- | paramiko/sftp_file.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index fe0f8c79..425a469a 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -378,8 +378,8 @@ class SFTPFile (BufferedFile): .. versionadded:: 1.5 """ self.pipelined = pipelined - - def prefetch(self, file_size): + + def prefetch(self, file_size=None): """ Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can @@ -393,6 +393,10 @@ class SFTPFile (BufferedFile): .. versionadded:: 1.5.1 """ + + if file_size is None: + file_size = self.stat().st_size; + # queue up async reads for the rest of the file chunks = [] n = self._realpos |