fix binary format

This commit is contained in:
awe
2026-02-25 18:33:50 +03:00
parent d56e439bf2
commit 267ddedb19
6 changed files with 121 additions and 47 deletions

View File

@ -75,16 +75,20 @@ def main():
else:
delay_per_byte = 0.0
_CHUNK = 4096
loop = 0
try:
while True:
loop += 1
print(f"[loop {loop}] {args.file}")
with open(args.file, "rb") as f:
for line in f:
os.write(master_fd, line)
while True:
chunk = f.read(_CHUNK)
if not chunk:
break
os.write(master_fd, chunk)
if delay_per_byte > 0:
time.sleep(delay_per_byte * len(line))
time.sleep(delay_per_byte * len(chunk))
except KeyboardInterrupt:
print("\nОстановлено.")
finally: