diff options
author | [Stephen D. Van Hooser] <[vanhoosr@brandeis.edu]> | 2016-02-03 18:02:22 -0500 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2016-04-25 10:05:08 -0700 |
commit | 24f3ed3fccb6b4321fefb9f1b3fdb0c1067f6a26 (patch) | |
tree | 71f998449aae99c76ae5e665b11734ebbc171afc /paramiko/sftp_file.py | |
parent | 036e550ff77de1988ad376b26b439fa105ae00a5 (diff) | |
download | paramiko-24f3ed3fccb6b4321fefb9f1b3fdb0c1067f6a26.tar.gz |
paramiko.sftp_file.prefetch now backwards compatible
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 |