diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-01-27 19:22:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 19:22:47 (GMT) |
commit | 7c684073f951dd891021676ecfd86ffc18b8895e (patch) | |
tree | b19f8254e8c3f3ac516b922eda7b985edbfebf70 /Doc | |
parent | f13f12d8daa587b5fcc66fe3ed1090a5dadab289 (diff) | |
download | cpython-7c684073f951dd891021676ecfd86ffc18b8895e.zip cpython-7c684073f951dd891021676ecfd86ffc18b8895e.tar.gz cpython-7c684073f951dd891021676ecfd86ffc18b8895e.tar.bz2 |
bpo-32622: Implement loop.sendfile() (#5271)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 834a4e8..fe16223 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -543,6 +543,37 @@ Creating listening connections .. versionadded:: 3.5.3 +File Transferring +----------------- + +.. coroutinemethod:: AbstractEventLoop.sendfile(sock, transport, \ + offset=0, count=None, \ + *, fallback=True) + + Send a *file* to *transport*, return the total number of bytes + which were sent. + + The method uses high-performance :meth:`os.sendfile` if available. + + *file* must be a regular file object opened in binary mode. + + *offset* tells from where to start reading the file. If specified, + *count* is the total number of bytes to transmit as opposed to + sending the file until EOF is reached. File position is updated on + return or also in case of error in which case :meth:`file.tell() + <io.IOBase.tell>` can be used to figure out the number of bytes + which were sent. + + *fallback* set to ``True`` makes asyncio to manually read and send + the file when the platform does not support the sendfile syscall + (e.g. Windows or SSL socket on Unix). + + Raise :exc:`SendfileNotAvailableError` if the system does not support + *sendfile* syscall and *fallback* is ``False``. + + .. versionadded:: 3.7 + + TLS Upgrade ----------- |