Questions tagged [compression]

The name given to the process of encoding data such that it uses lesser number of bits as compared to the original representation.

There are a number of techniques to compress information, with most algorithms working to compress image, speech, music or video. Encoding the same information in lesser bits results in saving some crucial resource such as transmission bandwidth or hard-disk space. Compression algorithms also take advantage of human perception to further reduce the size of information. By encoding the same piece of information with fewer bits in places that the human brain is not accustomed to perceiving as well as other parts, substantial gains in compression ratios can be achieved.

9175 questions
25
votes
2 answers

Compressing large string in ruby

I have a web application(ruby on rails) that sends some YAML as the value of a hidden input field. Now I want to reduce the size of the text that is sent across to the browser. What is the most efficient form of lossless compression that would send…
gnarsi
  • 369
  • 1
  • 3
  • 8
25
votes
13 answers

How do you know if the HTTP compression is working?

How do you know if the HTTP compression setup is working? Is there any tool I can use to see the compressed page before it is uncompressed by the browser? Are there any tools to measure the amount compressed and response speed?
Hanz
  • 285
  • 1
  • 4
  • 5
25
votes
4 answers

how to decompress with pigz

I am trying to use pigz for parallel compress and decompress. I have found a way to compress in parallel using the following command: tar cf - /input/dir | pigz > output_file.tar.gz What is the equivalent command to decompress? I need to be able to…
user788171
  • 16,753
  • 40
  • 98
  • 125
25
votes
5 answers

Is there any well-known method for DRYing JSON

Consider this JSON response: [{ Name: 'Saeed', Age: 31 }, { Name: 'Maysam', Age: 32 }, { Name: 'Mehdi', Age: 27 }] This works fine for small amount of data, but when you want to serve larger amounts of data (say many…
Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188
25
votes
9 answers

Really simple short string compression

Is there a really simple compression technique for strings up to about 255 characters in length (yes, I'm compressing URLs)? I am not concerned with the strength of compression - I am looking for something that performs very well and is quick to…
cbp
  • 25,252
  • 29
  • 125
  • 205
24
votes
9 answers

Automate zip file reading in R

I need to automate R to read a csv datafile that's into a zip file. For example, I would type: read.zip(file = "myfile.zip") And internally, what would be done is: Unzip myfile.zip to a temporary folder Read the only file contained on it using…
João Daniel
  • 8,696
  • 11
  • 41
  • 65
24
votes
2 answers

How do you compress a string, and get a string back using zlib?

I am trying to utilize Zlib for text compression. For example I have a string T='blah blah blah blah' I need to compress it for this string. I am using S=zlib.compress(T) to compress it. Now what I want is to get the non-binary form of S so that I…
Quixotic
  • 2,424
  • 7
  • 36
  • 58
24
votes
5 answers

Compression issues with JQuery file in YUI Compressor

I am trying to minify a few files with YUI compressor. However, I seem to be getting an error on 2 lines of code, which prevents compression. The .js file for jcarouselLite contains 1 error, and my own code contains the other. I have narrowed it…
user47378
  • 271
  • 2
  • 3
  • 4
24
votes
8 answers

Compact decompression library for embedded use

We're currently creating a device for a customer that will get a block of data (like, say, 5-10KB) from a PC application. This is a bit simplified, so assume that the data must be passed and uncompressed a lot, not just once a year. The…
OregonGhost
  • 23,359
  • 7
  • 71
  • 108
24
votes
4 answers

How to compress a string?

I would like to have a reversible compression for a type of string so that i can include it in URLs without keeping track of what it refers to. The string i would like to compress is SVG path string, here is a short primer:…
FurtiveFelon
  • 14,714
  • 27
  • 76
  • 97
24
votes
4 answers

What is the maximum theoretically possible compression rate?

This is a theoretical question, so expect that many details here are not computable in practice or even in theory. Let's say I have a string s that I want to compress. The result should be a self-extracting binary (can be x86 assembler, but it can…
Albert
  • 65,406
  • 61
  • 242
  • 386
24
votes
5 answers

Recommendations for .NET compression library

I am looking for some recommendations about compressing data in .NET, aside from using the GZipStream class. I am looking for fast and high compression of byte arrays to be able to send them via TCP.
G-Man
  • 7,232
  • 18
  • 72
  • 100
24
votes
3 answers

How to count the number of files inside a tar.gz file (without decompressing)?

I have a tar.gz file which I have made by pigz (parallel gzip). I wanted to count the number of files inside the compressed file without decompressing it. I use this command: tar -tzf file.tar.gz but I got an error: tar: This does not look like a…
user3576287
  • 932
  • 3
  • 16
  • 30
24
votes
4 answers

Compressing multiple files using zlib

The below code will compress one file. How can I compress multiple files var gzip = zlib.createGzip(); var fs = require('fs'); var inp = fs.createReadStream('input.txt'); var out = fs.createWriteStream('input.txt.gz'); inp.pipe(gzip).pipe(out);
user3180402
  • 579
  • 2
  • 7
  • 16
24
votes
2 answers

Package the result of a build in Jenkins into a zip

I've just started using Jenkins and need some advice. After a successful build I would like to have the resulting directory packaged into a zip file and stored in workspace so later I can send to Artifactory. At the moment I'm using a program that I…
coder
  • 327
  • 2
  • 3
  • 7