import "zip" Codec.Archive.Zip (withArchive, getEntry, getEntries)
import Control.Concurrent.Async as CCA (mapConcurrently)
-import Control.Monad (join)
import Data.Attoparsec.ByteString (parseOnly, Parser)
+import Control.Monad (join)
import Data.Either(Either(..))
import Data.Either.Extra (partitionEithers)
import Data.List (concat, lookup)
import qualified Data.Map as DM
import qualified Data.Text as DT
import qualified Prelude as Prelude
+import System.IO.Temp (emptySystemTempFile)
import Gargantext.Core (Lang(..))
import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
-- different parser are available.
data FileFormat = WOS | RIS | RisPresse
| CsvGargV3 | CsvHal
+ | ZIP
deriving (Show)
-- Implemented (ISI Format)
$ partitionEithers
$ [runParser' WOS bs]
pure $ Right docs
+parseFormat ZIP bs = do
+ path <- emptySystemTempFile "parsed-zip"
+ DB.writeFile path bs
+ parsedZip <- withArchive path $ do
+ DM.keys <$> getEntries
+ pure $ Left $ "Not implemented for ZIP, parsedZip" <> show parsedZip
parseFormat _ _ = undefined
-- | Parse file into documents