Skip to content

Instantly share code, notes, and snippets.

@sdomermpc
Forked from mrkn/gist:861563
Created February 8, 2014 10:23
Show Gist options
  • Save sdomermpc/8881556 to your computer and use it in GitHub Desktop.
Save sdomermpc/8881556 to your computer and use it in GitHub Desktop.
require 'zlib'
filename = 'CONTENT'
#filename = 'NAME'
#filename = 'TITLE'
data = []
open(filename + '.tda.tdz', 'rb') do |idx|
open(filename + '.tda', 'rb') do |dat|
until idx.eof?
pre_size, post_size = idx.read(8).unpack('V*')
p [pre_size, post_size]
deflated = dat.read(post_size)
inflated = Zlib::Inflate.inflate(deflated)
p inflated.bytesize
data << inflated
end
end
end
data.each do |d|
d.split(/\0+/).each do |x|
puts x
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment