Is it possible to process a huge (~3G) file with pure Ruby (1.8) using limit开发者_JAVA技巧ed amount of RAM?
Yes, you can use Zlib::GzipReader to process it line by line using #each_line or #each_byte.
I guess the following would make sense:
Zlib::GzipReader.open(file) { |gz|
gz.each_line { |line|
#do stuff
}
gz.close
}
Let me know if you have a better solution.
精彩评论