You're actually gzipping normal.to_s
(which is something like "#<File:0x007f53c9b55b48>"
) in the following code.
# Files
normal = File.new('chunk0.nbt')
# Try to create gzip in program
make_gzip normal
You should read the content of the file, and make_gzip
on the content:
make_gzip normal.read
As I commented, the make_gzip
can be updated:
def self.make_gzip(data)
gz = Zlib::GzipWriter.new(StringIO.new)
gz << data
gz.close.string
end