From 943b4fff28c8dbd32ec0a99557d38758068bd93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D0=BD=D1=8C=D0=BA=D0=B8=D0=BD=20=D0=90=D0=BB?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Sat, 3 Sep 2022 00:35:14 +0300 Subject: [PATCH] SquashFs lz4 decompression support --- NyaFs/Filesystem/SquashFs/Compression/Lz4.cs | 8 ++++++-- readme.md | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NyaFs/Filesystem/SquashFs/Compression/Lz4.cs b/NyaFs/Filesystem/SquashFs/Compression/Lz4.cs index 43634c7..652ae08 100644 --- a/NyaFs/Filesystem/SquashFs/Compression/Lz4.cs +++ b/NyaFs/Filesystem/SquashFs/Compression/Lz4.cs @@ -1,4 +1,5 @@ using System; +using System.IO; namespace NyaFs.Filesystem.SquashFs.Compression { @@ -40,9 +41,12 @@ internal override byte[] Compress(byte[] data) throw new NotImplementedException(); } - internal override byte[] Decompress(byte[] data) + internal override byte[] Decompress(byte[] Data) { - throw new NotImplementedException(); + var Res = new byte[8192]; + + FT.LZ4.LZ4Codec.Decode(Data, 0, Data.Length, Res, 0, Res.Length); + return Res; } [Flags] diff --git a/readme.md b/readme.md index 15cea7c..f01d823 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ There is possible to add or update files in ramfs image. Supported at now: 1. CPIO ASCII (RW) 2. EXT2 (R) -3. SquashFs [xz, gzip, lzma compressed] (R) +3. SquashFs [xz, gzip, lzma, lz4 compressed] (R) ## Supported compression types Supported at now: @@ -93,7 +93,7 @@ Load fs from ext2 image: ``` load ramfs ext2 ``` -Load fs from squashfs image (xz, gzip, lzma compressed): +Load fs from squashfs image (xz, gzip, lzma, lz4 compressed): ``` load ramfs squashfs ```