Updated following dependencies as they need changes to the code to work properly:

- Scala
- fs2
- http4s
This commit is contained in:
Rehan Mahmood
2023-10-31 14:24:00 -04:00
parent c9ebd15b23
commit 2a39b2f6a6
64 changed files with 224 additions and 150 deletions

View File

@ -39,7 +39,7 @@ final case class Binary[F[_]](name: String, mime: MimeType, data: Stream[F, Byte
object Binary {
def apply[F[_]: Async](file: Path): Binary[F] =
def apply[F[_]: Files](file: Path): Binary[F] =
Binary(file.fileName.toString, Files[F].readAll(file))
def apply[F[_]](name: String, data: Stream[F, Byte]): Binary[F] =
@ -74,11 +74,11 @@ object Binary {
data.chunks.map(_.toByteVector).compile.fold(ByteVector.empty)((r, e) => r ++ e)
/** Convert paths into `Binary`s */
def toBinary[F[_]: Async]: Pipe[F, Path, Binary[F]] =
def toBinary[F[_]: Files]: Pipe[F, Path, Binary[F]] =
_.map(Binary[F](_))
/** Save one or more binaries to a target directory. */
def saveTo[F[_]: Async](
def saveTo[F[_]: Async: Files](
logger: Logger[F],
targetDir: Path
): Pipe[F, Binary[F], Path] =

View File

@ -72,6 +72,6 @@ object File {
.drain
.map(_ => file)
def readJson[F[_]: Async, A](file: Path)(implicit d: Decoder[A]): F[A] =
def readJson[F[_]: Async: Files, A](file: Path)(implicit d: Decoder[A]): F[A] =
readText[F](file).map(parser.decode[A]).rethrow
}

View File

@ -7,7 +7,7 @@
package docspell.common.util
import cats.effect._
import fs2.io.file.Path
import fs2.io.file.{Files, Path}
import fs2.{Pipe, Stream}
import docspell.common.Glob
@ -33,9 +33,9 @@ trait Zip[F[_]] {
}
object Zip {
val defaultChunkSize = 64 * 1024
private val defaultChunkSize = 64 * 1024
def apply[F[_]: Async](
def apply[F[_]: Async: Files](
logger: Option[Logger[F]] = None,
tempDir: Option[Path] = None
): Zip[F] =

View File

@ -22,7 +22,7 @@ import fs2.{Chunk, Pipe, Stream}
import docspell.common.Glob
import docspell.logging.Logger
final private class ZipImpl[F[_]: Async](
final private class ZipImpl[F[_]: Async: Files](
log: Option[Logger[F]],
tempDir: Option[Path]
) extends Zip[F] {