Configure pdf extraction; move Logger and DataType to common

This commit is contained in:
Eike Kettner
2020-02-17 14:01:36 +01:00
parent 3d615181e0
commit e0682464b5
12 changed files with 64 additions and 27 deletions

View File

@ -38,4 +38,9 @@ object TikaMimetype {
def detect[F[_]: Sync](data: Stream[F, Byte], hint: MimeTypeHint): F[MimeType] =
data.take(64).compile.toVector.map(bytes => fromBytes(bytes.toArray, hint))
def resolve[F[_]: Sync](dt: DataType, data: Stream[F, Byte]): F[MimeType] =
dt match {
case DataType.Exact(mt) => mt.pure[F]
case DataType.Hint(hint) => TikaMimetype.detect(data, hint)
}
}