Skip to content

Instantly share code, notes, and snippets.

@EdgarOrtegaRamirez
Last active March 3, 2022 18:37
Show Gist options
  • Save EdgarOrtegaRamirez/14aa7e390e92f4806e73cbbc28aba003 to your computer and use it in GitHub Desktop.
Save EdgarOrtegaRamirez/14aa7e390e92f4806e73cbbc28aba003 to your computer and use it in GitHub Desktop.
Ruby - Append to a gzip CSV file
require "zlib"
open_mode = "ab" # append / binary
file = File.open('path-to-file.csv.gz', open_mode)
gz = Zlib::GzipWriter.new(file)
gz.write("new,row,csv\n")
gz.close
# http://ruby-doc.org/core-2.5.3/IO.html#method-c-new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment