gzip-uncompressed-size - Determine the estimated uncompressed size from a GZIP file (uses ISIZE).
This module returns the GZIP ISIZE, which according to the specification, contains the size of the original (uncompressed) input. It has been documented that the size reported is not 100% accurate.
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.npm.gzipuncompressedsize._
GzipUncompressedSize.fromFile("my/compressed/file.gz", (error, uncompressedSize) => {
error match {
case null => println(s"uncompressedSize = $uncompressedSize")
case err => println(s"An error occurred: ${err.message}")
}
})
import io.scalajs.npm.gzipuncompressedsize._
import scalajs.concurrent.JSExecutionContext.Implicits.queue
import scala.util.{Failure, Success}
GzipUncompressedSize.fromFileAsync("my/compressed/file.gz").future onComplete {
case Success(uncompressedSize) =>
println(s"uncompressedSize = $uncompressedSize")
case Failure(e) =>
println(s"An error occurred: ${e.getMessage}")
}
To add the gzip-uncompressed-size
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "gzip-uncompressed-size" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")