Skip to content

Add IO.copy_stream - #479

Merged
tannevaled merged 1 commit into
mainfrom
feat/io-copy-stream
Aug 28, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/io-copy-stream

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

IO.copy_stream(src, dst, copy_length = nil, src_offset = nil) copies bytes from
src to dst, each of which may be a path String (read/written via
binread / binwrite) or an IO (read/written through the IO protocol), and
returns the number of bytes copied. A copy_length limits the amount;
src_offset is honoured for a path but rejected for a non-fd IO such as
StringIO, matching MRI; fewer than two arguments raises ArgumentError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 16080 → 16095 (core/io/copy_stream 0 → 25, zero regressions
in a deterministic per-file sweep). The pread-based src_offset for real IO and
partial-read forms remain a follow-up.

🤖 Generated with Claude Code

IO.copy_stream(src, dst, copy_length = nil, src_offset = nil) copies bytes from
src to dst, each of which may be a path String (read/written via binread /
binwrite) or an IO (read/written through the IO protocol), and returns the number
of bytes copied. A copy_length limits the amount; src_offset is honoured for a
path but rejected for a non-fd IO such as StringIO, matching MRI; and fewer than
two arguments raises ArgumentError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 16080 -> 16095 (core/io/copy_stream 0 -> 25).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 1188ed0 into main Aug 28, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/io-copy-stream branch August 28, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant