     db_file_gz = db_file <> ".gz"
 
     cond do
-      File.regular?(db_file)    -> parse_countries(File.read(db_file))
-      File.regular?(db_file_gz) -> parse_countries_gz(File.read(db_file_gz))
+      File.regular?(db_file)    -> parse_countries({ :regular, db_file })
+      File.regular?(db_file_gz) -> parse_countries({ :gzip , db_file_gz})
       true -> { :error, "Failed to find 'GeoLite2-Country.mmdb[.gz]' in given path '#{db_dir}'!" }
     end
   end
 
-  defp parse_countries_gz({ :ok, gz_data }) do
-    parse_countries(:zlib.gunzip(gz_data))
+  defp parse_countries({ :regular, db_file }) do
+    stream_countries(File.binstream!(db_file, [:read], 1))
   end
-  defp parse_countries_gz({ :error, reason }) do
-    { :error, "Failed to read country db: #{reason}" }
+  defp parse_countries({ :gzip, db_file }) do
+    stream_countries(File.binstream!(db_file, [:read, :compressed], 1))
   end
 
-  defp parse_countries({ :ok, data }) do
-    parse_countries(data)
+  defp stream_countries(stream) do
+    meta_stream = drop_until_meta(stream)
+
+    IO.puts inspect(@metadata_marker) <> " <> " <> inspect(Enum.join(Enum.take(meta_stream, byte_size(@metadata_marker))))
   end
-  defp parse_countries(data) when is_binary(data) do
-    IO.inspect "Reading stuff! Size: " <> integer_to_binary(String.length(data))
-    []
+
+  defp drop_until_meta(stream) do
+    stream = Enum.drop_while(stream, fn(c) -> c != String.at(@metadata_marker, 0) end)
+    marker = Enum.take(stream, byte_size(@metadata_marker)) |> Enum.join
+
+    if marker == @metadata_marker do
+      stream
+    else
+      drop_until_meta(Enum.drop(stream, 1))
+    end
   end
 end

    end
  end

  defp read_cities(db_dir) do
    []
  end


defmodule Geolix.Database do
  @metadata_marker <<171, 205, 239>> <> "MaxMind.com"

  def read(db_dir) do
    cities    = read_cities(db_dir)
