The splice family of Linux system calls can transfer data between file descriptors without the need to copy data into userspace. Instead of a userspace buffer, they rely on an ordinary Unix pipe as a kernel-level buffer.
Ruby io_splice hackers
gem "io_splice", "~> 4.2.0"