What is the simplest way to read a text file inside a zip file in Ruby? Something similar to PHP's file_get_contents("zip://archive.zip#article.txt")
require 'zip/zip'
Zip::ZipFile.new("archive.zip").read("article.txt")
Try it
require 'zip/zip'
Zip::ZipFile.open("my.zip", Zip::ZipFile::CREATE) {|zipfile| puts zipfile.read("first.txt")}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With