Archive cache¶
Example¶
Get the directory where an archive is extracted with
import coursier.cache.ArchiveCache
import coursier.util.Artifact
val archiveCache = ArchiveCache()
val dir = archiveCache.get(Artifact("https://cosmo.zip/pub/cosmocc/cosmocc-3.9.7.zip")).unsafeRun()(archiveCache.cache.ec) // java.io.File
Progress bars¶
Enable those on a standard cache, and pass it to the ArchiveCache to get progress bars
when files are being downloaded:
import coursier.cache.{ArchiveCache, FileCache}
import coursier.cache.loggers.RefreshLogger
import coursier.util.Artifact
val logger = RefreshLogger.create()
val cache = FileCache().withLogger(logger)
val archiveCache = ArchiveCache().withCache(cache)
val dir = logger.using(archiveCache.get(Artifact("https://cosmo.zip/pub/cosmocc/cosmocc-3.9.7.zip"))).unsafeRun()(archiveCache.cache.ec) // java.io.File
Note that there's no progress reporting while the archive is being extracted for now.
Archive cache location¶
Get the archive cache location with
Set the directory under which all archives are extracted with
Override it with
Note that this only changes the directory under which archives are extracted, not
the directory where these are downloaded. To change the latter too,
create a standard cache instance with a custom location,
and pass it to the ArchiveCache with withCache like above.