Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- def read_chunks(self, size=1024, *, mode='rb'):
- with self.open(mode) as f:
- sentinel = b'' if 'b' in mode else ''
- for chunk in iter(lambda: f.read(size), sentinel):
- yield chunk
- Path.read_chunks = read_chunks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement