sealed trait Compression[F[_]] extends CompressionPlatform[F]
Provides the capability to compress/decompress using deflate and gzip.
On JVM an instance is available given a Sync[F]
.
On Node.js an instance is available for Async[F]
by importing fs2.io.compression._
.
- Source
- Compression.scala
- Alphabetic
- By Inheritance
- Compression
- CompressionPlatform
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def deflate(deflateParams: DeflateParams): Pipe[F, Byte, Byte]
- abstract def gunzip(inflateParams: InflateParams): (Stream[F, Byte]) => Stream[F, GunzipResult[F]]
Returns a pipe that incrementally decompresses input according to the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt.
Returns a pipe that incrementally decompresses input according to the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Any errors in decompression will be sequenced as exceptions into the output stream. Decompression is handled in a streaming and async fashion without any thread blockage.
The chunk size here is actually really important. Matching the input stream largest chunk size, or roughly 8 KB (whichever is larger) is a good rule of thumb.
- inflateParams
- returns
- abstract def gzip(fileName: Option[Nothing], modificationTime: Option[Nothing], comment: Option[Nothing], deflateParams: DeflateParams): Pipe[F, Byte, Byte]
Returns a pipe that incrementally compresses input into the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt.
Returns a pipe that incrementally compresses input into the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Output is compatible with the GNU utils
gunzip
utility, as well as really anything else that understands GZIP. Note, however, that the GZIP format is not "stable" in the sense that all compressors will produce identical output given identical input. Part of the header seeding is arbitrary and chosen by the compression implementation. For this reason, the exact bytes produced by this pipe will differ in insignificant ways from the exact bytes produced by a tool like the GNU utilsgzip
.GZIP wraps a deflate stream with file attributes and stream integrity validation. Therefore, GZIP is a good choice for compressing finite, complete, readily-available, continuous or file streams. A simpler deflate stream may be better suited to real-time, intermittent, fragmented, interactive or discontinuous streams where network protocols typically provide stream integrity validation.
- fileName
optional file name
- modificationTime
optional file modification time
- comment
optional file comment
- deflateParams
- Definition Classes
- CompressionPlatform
- abstract def inflate(inflateParams: InflateParams): Pipe[F, Byte, Byte]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def gunzip(bufferSize: Int = 1024 * 32): (Stream[F, Byte]) => Stream[F, GunzipResult[F]]
Returns a pipe that incrementally decompresses input according to the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt.
Returns a pipe that incrementally decompresses input according to the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Any errors in decompression will be sequenced as exceptions into the output stream. Decompression is handled in a streaming and async fashion without any thread blockage.
The chunk size here is actually really important. Matching the input stream largest chunk size, or roughly 8 KB (whichever is larger) is a good rule of thumb.
- bufferSize
The bounding size of the input buffer. This should roughly match the size of the largest chunk in the input stream. This will also be the chunk size in the output stream. Default size is 32 KB.
- returns
- def gzip(bufferSize: Int = 1024 * 32, deflateLevel: Option[Int] = None, deflateStrategy: Option[Int] = None, modificationTime: Option[Nothing] = None, fileName: Option[Nothing] = None, comment: Option[Nothing] = None): Pipe[F, Byte, Byte]
Returns a pipe that incrementally compresses input into the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt.
Returns a pipe that incrementally compresses input into the GZIP format as defined by RFC 1952 at https://www.ietf.org/rfc/rfc1952.txt. Output is compatible with the GNU utils
gunzip
utility, as well as really anything else that understands GZIP. Note, however, that the GZIP format is not "stable" in the sense that all compressors will produce identical output given identical input. Part of the header seeding is arbitrary and chosen by the compression implementation. For this reason, the exact bytes produced by this pipe will differ in insignificant ways from the exact bytes produced by a tool like the GNU utilsgzip
.GZIP wraps a deflate stream with file attributes and stream integrity validation. Therefore, GZIP is a good choice for compressing finite, complete, readily-available, continuous or file streams. A simpler deflate stream may be better suited to real-time, intermittent, fragmented, interactive or discontinuous streams where network protocols typically provide stream integrity validation.
- bufferSize
The buffer size which will be used to page data into chunks. This will be the chunk size of the output stream. You should set it to be equal to the size of the largest chunk in the input stream. Setting this to a size which is smaller than the chunks in the input stream will result in performance degradation of roughly 50-75%. Default size is 32 KB.
- deflateLevel
level the compression level (0-9)
- deflateStrategy
strategy compression strategy -- see
java.util.zip.Deflater
for details- modificationTime
optional file modification time
- fileName
optional file name
- comment
optional file comment
- Definition Classes
- CompressionPlatform
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])