test_copy_stream: fix userspace buffering assumption
[ruby_io_splice.git] / examples / splice-cp.rb
blobbf0d518b008356d1f9a2bc3631846968fe660d0e
1 #!/usr/bin/env ruby
2 # -*- encoding: binary -*-
4 # Example of using IO.splice to copy a file
5 # This can be significantly faster than IO.copy_stream as data
6 # is never copied into userspace.
8 require 'io/splice'
10 usage = "#$0 SOURCE DEST"
11 source = ARGV.shift or abort usage
12 dest = ARGV.shift or abort usage
13 IO::Splice.copy_stream(source, dest)