Simply install and reference the server actions.
This code is a method that unzips a specific file inside a tar.gz compressed folder. It takes in a byte array of the compressed file, the full path name of the file intended to be extracted, and an output byte array for the extracted file and string for the name of the extracted file. It also has an output string for a list of all the files and directories found in the compressed file. The code creates a GZipStream from the MemoryStream of the compressed file, then creates a TarInputStream from that GZipStream. It then iterates through each entry in that TarInputStream, adding each entry's name to ssListOfFiles separated by ";". If it finds an entry with the same name as ssFilename, it sets ssUnzippedFile to be that entry's contents as an array of bytes and sets ssUnzippedName to be that entry's name.
Install the demo to see the example of utilization.
This code is a class that implements methods for compressing and decompressing files in the tar.gz format. The MssTAR_GZIP_Zip method takes a list of files and compresses them into a tar.gz file, while the MssTAR_GZIP_Unzip method takes a tar.gz file and extracts a specific file from it. The code uses various libraries to accomplish this, such as System, OutSystems.HubEdition.RuntimePlatform, OutSystems.RuntimePublic.Db, System.IO, System.IO.Compression, System.Collections.Generic, System.Text, System.Text.RegularExpressions, System.Linq, ICSharpCodeSharpZipLibZip and ICSharpCodeSharpZipLibTar, and ICSharpCodeSharpZipLibGZip to create the tar file and compress it with Gzip compression algorithm respectively.
Simply install and reference the server action TAR_GZIP_Unzip.
This code is used to unzip a tar.gz file. It takes a byte array of the zipped file, the filename of the file to be unzipped, and outputs a byte array of the unzipped file, the name of the unzipped file, and a list of all files in the tar.gz file. It uses MemoryStreams, GZipStreams, and TarInputStreams to accomplish this task.