reverse_io

privex.helpers.common.reverse_io(f: BinaryIO, blocksize: int = 4096) → Generator[bytes, None, None][source]

Read file as series of blocks from end of file to start.

The data itself is in normal order, only the order of the blocks is reversed. ie. “hello world” -> [“ld”,”wor”, “lo “, “hel”] Note that the file must be opened in binary mode.

Original source: https://stackoverflow.com/a/136354