(define (read/write filename length outport #!optional (bs (* 1024 2))) (print "Length : " length ", blocksize " bs ) (let ((bar (make-progress-bar frame: (string-append filename ": [~a~a~a~a|~a]") width: 40 max: length))) (let loop ((size length)) (let* ((bytes (min bs size))) (if (zero? size) #t (let ((input (read-string bytes))) (if input (write-string input bytes outport) (when (> bytes 0) (error "Missing ~a from input" (pretty-filesize bytes)))) (advance-progress-bar! bar bytes) (loop (- size bytes)))))) (finish-progress-bar! bar)))