Created
April 27, 2025 21:12
-
-
Save havenwood/4007b81e027a83829390a9e25b70cab5 to your computer and use it in GitHub Desktop.
Just a fun example for Ruby IRC playing with IO.copy_stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stringio' | |
require 'zlib' | |
io = StringIO.new('Zip me...') | |
zipped_io = StringIO.new('', 'a+b') | |
writer = Zlib::GzipWriter.new(zipped_io) | |
IO.copy_stream(io, writer) | |
writer.finish | |
zipped_io.rewind | |
IO.copy_stream(zipped_io, $stdout) | |
writer.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment