All Projects → gonearewe → Sevenz4s

gonearewe / Sevenz4s

Licence: lgpl-2.1
SevenZip library for Scala, easy to use.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Sevenz4s

Minizip Ng
Fork of the popular zip manipulation library found in the zlib distribution.
Stars: ✭ 750 (+1873.68%)
Mutual labels:  compression
Compressed Vec
SIMD Floating point and integer compressed vector library
Stars: ✭ 25 (-34.21%)
Mutual labels:  compression
Drv3 Tools
(Not actively maintained, use DRV3-Sharp) Tools for extracting and re-injecting files for Danganronpa V3 for PC.
Stars: ✭ 13 (-65.79%)
Mutual labels:  compression
Compressonator
Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs
Stars: ✭ 785 (+1965.79%)
Mutual labels:  compression
Borgmatic
Simple, configuration-driven backup software for servers and workstations
Stars: ✭ 902 (+2273.68%)
Mutual labels:  compression
Nippy
High-performance serialization library for Clojure
Stars: ✭ 838 (+2105.26%)
Mutual labels:  compression
Dandere2x
Dandere2x - Fast Waifu2x Video Upscaling.
Stars: ✭ 723 (+1802.63%)
Mutual labels:  compression
Imgsquash
Simple image compression full website code written in node, react and next.js framework. Easy to deploy as a microservice.
Stars: ✭ 948 (+2394.74%)
Mutual labels:  compression
Blosc.jl
Blosc compression for the Julia language
Stars: ✭ 24 (-36.84%)
Mutual labels:  compression
Srec
PyTorch Implementation of "Lossless Image Compression through Super-Resolution"
Stars: ✭ 868 (+2184.21%)
Mutual labels:  compression
Gan Compression
[CVPR 2020] GAN Compression: Efficient Architectures for Interactive Conditional GANs
Stars: ✭ 800 (+2005.26%)
Mutual labels:  compression
Peazip
Free Zip / Unzip software and Rar file extractor. Cross-platform file and archive manager. Features volume spanning, compression, authenticated encryption. Supports 7Z, 7-Zip sfx, ACE, ARJ, Brotli, BZ2, CAB, CHM, CPIO, DEB, GZ, ISO, JAR, LHA/LZH, NSIS, OOo, PAQ/LPAQ, PEA, QUAD, RAR, RPM, split, TAR, Z, ZIP, ZIPX, Zstandard.
Stars: ✭ 827 (+2076.32%)
Mutual labels:  compression
Image Actions
A Github Action that automatically compresses JPEGs, PNGs and WebPs in Pull Requests.
Stars: ✭ 844 (+2121.05%)
Mutual labels:  compression
Flyimg
Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).
Stars: ✭ 762 (+1905.26%)
Mutual labels:  compression
Iscompress
Inno Setup zlib, bzlib and lzma compression source code - see issrc repository for lzma2 compression source code.
Stars: ✭ 21 (-44.74%)
Mutual labels:  compression
C Blosc
A blocking, shuffling and loss-less compression library that can be faster than `memcpy()`.
Stars: ✭ 742 (+1852.63%)
Mutual labels:  compression
Scn
Scale-wise Convolution for Image Restoration
Stars: ✭ 26 (-31.58%)
Mutual labels:  compression
Finitestateentropy
New generation entropy codecs : Finite State Entropy and Huff0
Stars: ✭ 949 (+2397.37%)
Mutual labels:  compression
Bcnencoder.net
Cross-platform texture encoding libary for .NET. With support for BC1-3/DXT, BC4-5/RGTC and BC7/BPTC compression. Outputs files in ktx or dds formats.
Stars: ✭ 28 (-26.32%)
Mutual labels:  compression
Lib
single header libraries for C/C++
Stars: ✭ 866 (+2178.95%)
Mutual labels:  compression

SevenZ4S

Maven Central Scaladoc GitHub stars GitHub forks GitHub issues license

Introduction

This a 7Z compression library for Scala(v2.13), providing simple api to create, update and extract archives of different formats.

This library offers compression and update abilities for 5 formats:

7-Zip	Zip	 GZip	Tar	 BZip2

As for extraction, following formats are all supported:

7-Zip	Zip	Rar	Tar	 Split	Lzma   Iso	HFS	 GZip
Cpio	BZip2	Z	 Arj	Chm	   Lhz	Cab	 Nsis
Ar/A/Lib/Deb	Rpm	 Wim	Udf	   Fat	Ntfs

Multiple platforms are also supported.

This project is based on net.sf.sevenzipjbinding, which is a 7z binding library for java. You may acquire more info from its homepage. Also, it's licensed under LGPL and unRAR restriction.

Quick Start

For creating archives, you need to first acquire an instance of concrete ArchiveCreator. There're 5 kinds of ArchiveCreator, one for each format. Some features and callback hooks may be optional. Archive is composed of many entries, you need to pass some to compress method to finish compression. Object SevenZ4S provides some utils that may help gain entries from local file system.

  val path: Path = new File(getClass.getResource("/root").getFile).toPath

  def create7Z(): Unit = {
    val entries = SevenZ4S.get7ZEntriesFrom(path)
    new ArchiveCreator7Z()
      .towards(path.resolveSibling("root.7z"))
      // archive-relevant features
      .setLevel(5)
      .setSolid(true)
      .setHeaderEncryption(true)
      .setPassword("12345")
      .setThreadCount(3)
      .onEachEnd {
        ok =>
          if (ok)
            println("one success")
          else
            println("one failure")
      }.onProcess {
      (completed, total) =>
        println(s"$completed of $total")
    }.compress(entries)
  }

7Z engine offers abilities to modify, append and remove a few entries in a more efficient way. Use ArchiveUpdater to update archive instead of extract-modify-compress by yourself.

  // import ...
  import fun.mactavish.sevenz4s.Implicits._
  
  def update7Z(): Unit = {
    val replacement = path.resolveSibling("replace.txt")

    val updater = new ArchiveUpdater7Z()
      .from(path.resolveSibling("root.7z")) // update itself
      .withPassword("12345")
      .update {
        entry =>
          if (entry.path == "root\\a.txt") { // path separator is OS-relevant
            entry.copy(
              dataSize = Files.size(replacement), // remember to update size
              source = replacement, // implicit conversion happens here
              path = "root\\a replaced.txt" // file name contains space
            )
          } else {
            entry
          }
      }

    updater.removeWhere(entry => entry.path == "root\\sub\\deeper\\c.txt")
    // directory can not be deleted until its contents have all been deleted,
    // otherwise, it ignores the request silently rather than raise an exception.
    updater.removeWhere(entry => entry.path == "root\\sub\\deeper")
    updater += SevenZ4S.get7ZEntriesFrom(replacement).head
    // notice that file with the same name is allowed,
    // but may be overwritten by OS's file system during extraction
    updater += SevenZ4S.get7ZEntriesFrom(replacement).head
  }

Unlike ArchiveCreator and ArchiveUpdater, SevenZ4S provides a generic ArchiveExtractor supporting the extraction of all formats. It can autodetect the format of input archive.

  def extract7Z(): Unit = {
    new ArchiveExtractor()
      .from(path.resolveSibling("root.7z"))
      .withPassword("12345")
      .onEachEnd(println(_))
      .foreach { entry =>
        println(entry.path)
        if (entry.path == "root\\b.txt") {
          // extract independently
          entry.extractTo(path.resolveSibling("b extraction.txt"))
        }
      }
      // `extractTo` takes output folder `Path` as parameter
      // `onEachEnd` callback only triggers on `extractTo`
      .extractTo(path.resolveSibling("extraction"))
      .close() // ArchiveExtractor requires closing
  }

If all you want is simply compressing and extracting files on local file system, the object SevenZ4S provides super useful utilities.

  val path: Path = new File(getClass.getResource("/root").getFile).toPath

  def test7Z(): Unit = {
    val output = path.resolveSibling("util test/7z")

    SevenZ4S.compress(ArchiveFormat.SEVEN_Z, path, output)
    val f = output.resolve("root.7z")

    SevenZ4S.extract(f, output)
  }

Refer to the test cases and test resources for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].