mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Experiment with addons
Addons allow to execute external programs in some context inside docspell. Currently it is possible to run them after processing files. Addons are provided by URLs to zip files.
This commit is contained in:
BIN
modules/files/src/test/resources/zip-dirs-one.zip
Normal file
BIN
modules/files/src/test/resources/zip-dirs-one.zip
Normal file
Binary file not shown.
BIN
modules/files/src/test/resources/zip-dirs.zip
Normal file
BIN
modules/files/src/test/resources/zip-dirs.zip
Normal file
Binary file not shown.
@ -7,20 +7,25 @@
|
||||
package docspell.files
|
||||
|
||||
import cats.effect._
|
||||
import cats.effect.unsafe.implicits.global
|
||||
import cats.implicits._
|
||||
import fs2.io.file.{Files, Path}
|
||||
|
||||
import docspell.common.Glob
|
||||
import docspell.logging.TestLoggingConfig
|
||||
|
||||
import munit._
|
||||
|
||||
class ZipTest extends FunSuite {
|
||||
class ZipTest extends CatsEffectSuite with TestLoggingConfig {
|
||||
val logger = docspell.logging.getLogger[IO]
|
||||
val tempDir = ResourceFixture(
|
||||
Files[IO].tempDirectory(Path("target").some, "zip-test-", None)
|
||||
)
|
||||
|
||||
test("unzip") {
|
||||
val zipFile = ExampleFiles.letters_zip.readURL[IO](8192)
|
||||
val uncomp = zipFile.through(Zip.unzip(8192, Glob.all))
|
||||
val unzip = zipFile.through(Zip.unzip(8192, Glob.all))
|
||||
|
||||
uncomp
|
||||
unzip
|
||||
.evalMap { entry =>
|
||||
val x = entry.data.map(_ => 1).foldMonoid.compile.lastOrError
|
||||
x.map { size =>
|
||||
@ -35,6 +40,10 @@ class ZipTest extends FunSuite {
|
||||
}
|
||||
.compile
|
||||
.drain
|
||||
.unsafeRunSync()
|
||||
}
|
||||
|
||||
tempDir.test("unzipTo directory tree") { _ =>
|
||||
// val zipFile = ExampleFiles.zip_dirs_zip.readURL[IO](8192)
|
||||
// zipFile.through(Zip.unzip(G))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user