This is likely a good addition to reference_mpy_shed\buffer_mp.pyi
but care must be taken to verify correct operation and conflicts.
Also need to determine how to work with , or replace AnyReadableBuf and AnyWritableBuf
The signature is:
stream.write(buf)
stream.write(buf, max_len)
stream.write(buf, off, max_len)
I don't think this is actually documented anywhere, but it may be relied upon in some code.
Originally posted by @dpgeorge in micropython/micropython#17938 (comment)