Skip to content

nwtgck/akka-stream-zstd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

akka-stream-zstd

Build Status Coverage Status

Zstandard for Akka Stream

Installation

Add the following lines to your build.sbt.

// Add dependency of `akka-stream-zstd.git` on GitHub
dependsOn(RootProject(uri("https://github.com/nwtgck/akka-stream-zstd.git#v0.1.5")))

Example of compression

Here is an example to compress and store into a file

source
  // Compress
  .via(ZstdFlow.compress())
  // Store to file
  .runWith(FileIO.toPath(filePath))

Full example

Example of decompression

Here is an example to decompress from a stored file and convert into a String.

FileIO.fromPath(filePath)
  // Decompress
  .via(ZstdFlow.decompress())
  // Concatenate into one ByteString
  .runWith(Sink.fold(ByteString.empty)(_ ++ _))
  // Convert ByteString to String
  .map(_.utf8String)

Full example

Example repository

Here is a full example.