about summary refs log blame commit diff stats
path: root/data/generate.rb
blob: bc85b93b3699e0ee5e2aa943e603e6a0961b9c30 (plain) (tree)
1
2
               
                                         



















                                         
#!/usr/bin/ruby
## Parses mime.types and creates mime.dat

file = File.read(ARGV[0] || "mime.types")

table = {}
for l in file.lines
	next if l[0] == ?#
	next unless l.size > 3
	next unless l.include? ?\t

	left, *exts = l.split(/\s+/)
#	print exts.inspect
	for ext in exts
		table[ext] = left
	end
end

File.open('mime.dat', 'w') do |f|
	f.write Marshal.dump(table)
end