Integrations for several compression algorithms with Fs2.
libraryDependencies += "de.lhns" %% "fs2-compress-gzip" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-zip" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-zip4j" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-tar" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-bzip2" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-zstd" % "2.0.0"
libraryDependencies += "de.lhns" %% "fs2-compress-brotli" % "2.0.0"
import cats.effect.IO
import de.lhns.fs2.compress.{GzipCompressor, GzipDecompressor}
import fs2.io.compression._
import fs2.io.file.{Files, Path}
implicit val gzipCompressor: GzipCompressor[IO] = GzipCompressor.make()
implicit val gzipDecompressor: GzipDecompressor[IO] = GzipDecompressor.make()
for {
_ <- Files[IO].readAll(Path("file"))
.through(GzipCompressor[IO].compress)
.through(Files[IO].writeAll(Path("file.gz")))
.compile
.drain
_ <- Files[IO].readAll(Path("file.gz"))
.through(GzipDecompressor[IO].decompress)
.through(Files[IO].writeAll(Path("file")))
.compile
.drain
} yield ()
This project uses the Apache 2.0 License. See the file called LICENSE.