Разработана утилита для многопоточного сжатия файлов WebAssembly

This commit is contained in:
2025-02-01 13:51:06 +03:00
commit f4cddc3e3e
13 changed files with 1146 additions and 0 deletions

44
app/algorithms.py Normal file
View File

@ -0,0 +1,44 @@
import gzip
import zlib
import brotli
import zstandard
def compress_with_brotli(
data: bytes,
level: int,
):
return brotli.compress(
data,
quality=level,
)
def compress_with_zstandard(
data: bytes,
level: int,
):
return zstandard.ZstdCompressor(
level=level,
).compress(data)
def compress_with_gzip(
data: bytes,
level: int,
):
return gzip.compress(
data,
compresslevel=level,
)
def compress_with_deflate(
data: bytes,
level: int,
):
return zlib.compress(
data,
level=level,
)