compression

Compress a file with RAR

*爱你&永不变心* 提交于 2019-12-01 16:26:56
I have a text file that I want to compress after it gets an specified size. I've already seen GZipStream which works great, but RAR compression is much better. I've been looking for a library that can compress a file with RAR (I really don't care about extracting or uncompressing), but I couldn't find one yet. As the RAR compression algorithm isn't free (only the decompression algorithm is), you won't find a library for it (or have to purchase a license). A good alternative is the LZMA SDK that delivers the compression algorithms used in 7-Zip. For a compression ratio/speed comparison, you can

How to unpack xz file with python which contains only data but no filename?

三世轮回 提交于 2019-12-01 16:21:58
I have a file, which I can decompress under linux using the following command: unxz < file.xz > file.txt How can I do the same using python? If I use python3 and the tarfile module and do the following: import sys import tarfile try: with tarfile.open('temp.xz', 'r:xz') as t: t.extract() except Exception as e: print("Error:", e.strerror) I get the exception: ReadError('invalid header',) . So apparently it expects some file- or directory information which is not present in the xz file. So how can I decompress a file without header information? The tarfile module is only for... err... tar files.

Is there a way to store gzip's dictionary from a file?

谁说我不能喝 提交于 2019-12-01 15:27:29
问题 I've been doing some research on compression-based text classification and I'm trying to figure out a way of storing a dictionary built by the encoder (on a training file) for use to run 'statically' on a test file? Is this at all possible using UNIX's gzip utility? For example I have been using 2 'class' files of sport.txt and atheism.txt, hence I want to run compression on both of these files and store their dictionaries used. Next I want to take a test file (which is unlabelled, could be

Library for further (lossless) Jpeg-compression

心不动则不痛 提交于 2019-12-01 14:45:33
问题 I'm looking for a library specialized at compressing Jpegs even further without changing the image. I've found PackJpeg but it doesn't provide any source code and you're not allowed to use it commercially. 回答1: On the PackJPG page, there's a link to the JPEG Open Source Developers Package. It doesn't include PackJPG source code, but basic routines to process and compress JPG data. This has been used to develop rejpeg which is open source and licensed under GPL v2. Matthias Stirner has made an

Creating a gzip stream from separately compressed chunks

丶灬走出姿态 提交于 2019-12-01 13:43:47
I like to be able to generate a gzip (.gz) file using concurrent CPU threads. I.e., I would be deflating separate chunks from the input file with separately initialized z_stream records. The resulting file should be readable by zlib's inflate() function in a classic single threaded operation. Is that possible? Even if it requires customized zlib code? The only requirement would be that the currently existing zlib's inflate code could handle it. Update The pigz source code demonstrates how it works. It uses some sophisticated optimizations to share the dictionary between chunks, keeping the

uncompressing tar.Z file with python?

三世轮回 提交于 2019-12-01 13:11:08
I need to write a python script that retrieves tar.Z files from an FTP server, and uncompress them on a windows machine. tar.Z, if I understood correctly is the result of a compress command in Unix. Python doesn't seem to know how to handle these, it's not gz, nor bz2 or zip. Does anyone know a library that would handle these ? Thanks in advance If GZIP -- the application -- can handle it, you have two choices. Try the Python gzip library. It may work. Use subprocess Popen to run gzip for you. It may be an InstallShield .Z file. You may want to use InstallShield to unpack it and extract the

How to solve Gzip Magic Number Missing

主宰稳场 提交于 2019-12-01 12:48:47
I have a string that I Gzip on the server and download to a client using the WebClient class. When I try to uncompress it, I get the error message that the Magic Number is missing. I have tried both the GZipStream class and the ICSharpLib methods of solving this, so I'm at a loss. The compression/decompression works if I omit the step of downloading via the WebClient (using DownloadData which returns the data as byte[]), so I can only assume that there is some problem with the data getting truncated or corrupted some how, but since it's compressed data, I'm not sure how to debug this. Here's

Gzip not working, server 2012, IIS 8

梦想的初衷 提交于 2019-12-01 12:27:05
Problems with activating Gzip on IIS 8 on a windows server 2012 (standard) So i activated the compressions in the windows features I checked both checkboxes in IIS - compression (dynamic and static) But still no Gzip available. However, on my localhost machine (just a windows 10) this works. What i do see, is that the gzip temp directory (C:\inetpub\temp\IIS Temporary Compressed Files) is getting filled up when i browse my site via the server localhost. BUT strangely enough i'm not seeing anything Gzip-ped in chrome. The only headers (in chrome) are: HTTP/1.1 304 Not Modified Accept-Ranges:

PHP compress files into zip

江枫思渺然 提交于 2019-12-01 12:04:59
Hello there okay so this is the deal i have a folder where my mp3 files are stored for single download, and now i want a feature where you can download all the mp3s at once in a zipped folder. Is it possible to zip all the files from that folder using php ( or anything really but if not PHP then please explain thoroughly) or would i have to just re-upload all the mp3s again in zipped format? Thanks you so much. Just to demonstrate use of the undocumented addGlob() method of the zipArchive class: $zipFile = dirname(__FILE__)."/myMP3s.zip"; $zipArchive = new ZipArchive(); if (!$zipArchive->open(

How to compress a directory with the built in .net compression classes?

帅比萌擦擦* 提交于 2019-12-01 11:32:53
Using the System.IO.Compression namespaces classes GZIPStream and DeflateStream I successfully can compress and decompress individual files. However, if I pass a directoryname as target for compression I get a security exception. Do I have to (recursively) enumerate all files and subdirectories to be able to compress a directory? (Probably dotnetzip from codeplex will handle this better, but that is not what I am after now). When you use GZipStream etc, you are compressing a stream ; not a file. GZip has no file header information, so there is no sensible way of packing multiple files. For