compression

How can I easily compress and decompress files using zlib? [closed]

∥☆過路亽.° 提交于 2020-01-09 05:14:04
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . How can I easily compress and decompress files using zlib? 回答1: For decompression: char buf[1024*1024*16]; gzFile *fi = (gzFile *)gzopen("file.gz","rb"); gzrewind(fi); while(!gzeof(fi)) { int len = gzread(fi,buf,sizeof(buf)); //buf contains len bytes of decompressed data } gzclose

How to detect type of compression used on the file? (if no file extension is specified)

点点圈 提交于 2020-01-08 19:40:17
问题 How can one detect the type of compression used on the file? (assuming that .zip, .gz, .xz or any other extension is not specified). Is this information stored somewhere in the header of that file? 回答1: You can determine that it is likely to be one of those formats by looking at the first few bytes. You should then test to see if it really is one of those, using an integrity check from the associated utility for that format, or by actually proceeding to decompress. You can find the header

gzip compression is not detected by PageSpeed Insights (node.js)

陌路散爱 提交于 2020-01-07 07:43:48
问题 I build my gzip-files with gulp ( gulp-gzip ) and use them with npm package connect-gzip-static : var app = express(); var serveStatic = require('connect-gzip-static'); //... app.use(serveStatic(__dirname)).listen(3000); However, PageSpeed Insights does not detect the gzip compression. But google chrome developer console it says: Response Headers: Content-Encoding: gzip. Also other seo testing tools are detecting gzip. Why Google doesen't ? I gziped all html, js, css. Should I also gzip svg's

Is it possible to minify Javascript, CSS and combine them in deploy time?

人盡茶涼 提交于 2020-01-07 04:52:31
问题 Is there a feature to minify and combine these files when deploying on Visual Studio? 回答1: There's an awesome article about this, have a read here. 来源: https://stackoverflow.com/questions/4233420/is-it-possible-to-minify-javascript-css-and-combine-them-in-deploy-time

zip and unzip files using DotNetZip

瘦欲@ 提交于 2020-01-07 04:17:06
问题 I am using DotNetZip. Using it to zip mp3 files. ZipFile zip = new ZipFile(); zip.Password = "123"; zip.AddFile("R:\\abc\\a\\a 2 z.mp3"); zip.Save("R:\\abc\\a\\aaa.zip"); After extraction of aaa.zip, I get a corrupted mp3 file. Having 3.31MB data when original had 3.62MB. How to resolve this problem? Any help is appreciated. 回答1: The documentation states here: Be aware that the ZipFile class implements the IDisposable interface. In order for ZipFile to produce a valid zip file, you use use it

Android Studio : Compress Video and Audio [closed]

独自空忆成欢 提交于 2020-01-07 02:57:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Working to compress Video and Audio files in Android Studio. I need Useful suggestion and links. I went through some of these links but didn't found much helpful . How to compress video in android` , Is there possibility to compress audio and video file in android programmatically?, FFmpegFrameGrabber crashes 100%

Uncompressing xml feed

橙三吉。 提交于 2020-01-07 02:47:09
问题 My application downloads a zipped xml file from the web and tries to create XML reader: var fullReportUrl = "http://..."; // valid url here //client below is an instance of HttpClient var fullReportResponse = client.GetAsync(fullReportUrl).Result; var zippedXmlStream = fullReportResponse.Content.ReadAsStreamAsync().Result; XmlReader xmlReader = null; using(var gZipStream = new GZipStream(zippedXmlStream, CompressionMode.Decompress)) { try { xmlReader = XmlReader.Create(gZipStream, settings);

Export to Excel file as .zip to reduce file size. How to compress xmldata before sending it to the client?

二次信任 提交于 2020-01-06 14:54:14
问题 I like to compress the xmldata before the data is provided to the client as an excel file. I am trying to compress and deliver it as a .zip file. its not working Here's my code below. Please help I tried compressing it, converting it to bytes etc etc. The issue with below code is, the XSL transformation is not happening properly and the output excel file is raw xml with some .net exception at the end. (that's what I see on the .xls file that's downloaded at the end) Before I started working

Compressing Numbers: Reading Error

别等时光非礼了梦想. 提交于 2020-01-06 14:41:33
问题 I am using this function for compression of Numbers: unsigned char *MyCompress(unsigned int num, unsigned char *buffer){ int i = 0; unsigned int r = num; unsigned char temp; unsigned char s[5]; printf("received %d to compress\n", num); if(!r){ *buffer++ = 0; return buffer; } while (r){ s[i] = r & 127; r >>= 7; printf("s[%d]=%d; r=%d\n", i, s[i], r); i++; } while (--i >= 0){ temp = (unsigned char)(s[i] | (i ? 128 : 0)); printf("temp=%d\n", temp); *buffer++=temp; } return buffer; } //Now

Copy TIFF image by using Libtiff

北慕城南 提交于 2020-01-06 11:55:07
问题 using (Tiff iimage = Tiff.Open("new.tif", "r")) { Tiff newiimage = Tiff.Open("newnew.tif", "w"); if (image == null) { MessageBox.Show("Could not open incoming image"); return; } using (StreamWriter writer = new StreamWriter("EnumerateTiffTags.txt")) { short numberOfDirectories = iimage.NumberOfDirectories(); for (short d = 0; d < numberOfDirectories; ++d) { iimage.SetDirectory((short)d); for (ushort t = ushort.MinValue; t < ushort.MaxValue; ++t) { TiffTag tag = (TiffTag)t; var value = iimage