Guest User

Untitled

a guest
May 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. from __future__ import with_statement
  2.  
  3. def sendfile(path, chunk_size=264704):
  4. """Poor man's sendfile for use with WSGI."""
  5. with open(path, 'r') as fh:
  6. while True:
  7. chunk = fh.read(chunk_size)
  8. if chunk == '':
  9. break
  10. yield chunk
Add Comment
Please, Sign In to add comment