I have designed a compression algorithm that operates on the byte level representation of a file.
I want to do the following procedure:
Read k bytes from
Run algorithm on byte array of size k outputting compressed material
Write compressed material to a new file
Repeat until file is exhausted.
How do I read the first k bytes of a file?
Furthermore I want these bytes to be in binary format. I noticed that python automatically convert bytes into string character when I use the open('filename', 'rb') method, I want to actually see the bytes in the form of (0101101) and not as an integer, string, etc...
Then I want to directly write, in this binary format, to a new file.