diff --git a/Data/GeoIP2.hs b/Data/GeoIP2.hs
--- a/Data/GeoIP2.hs
+++ b/Data/GeoIP2.hs
@@ -16,7 +16,7 @@
 
   -- * Opening the database
     GeoDB
-  , openGeoDB
+  , openGeoDB, openGeoDBBS
   , geoDbLanguages, geoDbType, geoDbDescription
   , geoDbAddrType, GeoIP(..)
   -- * Querying the database
@@ -67,6 +67,14 @@
 openGeoDB :: FilePath -> IO GeoDB
 openGeoDB geoFile = do
     bsmem <- mmapFileByteString geoFile Nothing
+    parseGeoDB bsmem
+
+-- | Open database from a bytestring, parse header and return a handle for search operations
+openGeoDBBS :: BS.ByteString -> IO GeoDB
+openGeoDBBS  = parseGeoDB
+
+parseGeoDB :: BS.ByteString -> IO GeoDB
+parseGeoDB bsmem = do
     DataMap hdr <- either error return $ decode (getHeaderBytes bsmem)
     when (hdr .: "binary_format_major_version" /= (2 :: Int)) $ error "Unsupported database version, only v2 supported."
     unless (hdr .: "record_size" `elem` [24, 28, 32 :: Int]) $ error "Record size not supported."
@@ -75,8 +83,6 @@
                        (hdr .: "node_count") (hdr .: "record_size")
                        (if (hdr .: "ip_version") == (4 :: Int) then GeoIPv4 else GeoIPv6)
                        (hdr .:? "description" ..? "en")
-
-
 
 rawGeoData :: GeoDB -> IP -> Either String GeoField
 rawGeoData geodb addr = do
diff --git a/geoip2.cabal b/geoip2.cabal
--- a/geoip2.cabal
+++ b/geoip2.cabal
@@ -1,5 +1,5 @@
 name:                geoip2
-version:             0.2.1.1
+version:             0.2.2.0
 synopsis:            Pure haskell interface to MaxMind GeoIP database
 description:
   GeoIP2 is a haskell binding to the MaxMind GeoIP2 database.
