zlib

ZLIB uncompress

早过忘川 提交于 2019-12-20 07:18:10
问题 I've coded a small application that should uncompress data encoded in the gzip/deflate format. In order to accomplish this,I'm using the ZLIB library, using the uncompress function. The problem is that the function doesn't work! In orher words, data is not uncompressed! I post here the code: int (*decompress)(PBYTE,PULONG,PBYTE,ULONG); void DecodeData(PBYTE data,ULONG dataSize){ LoadLibrary("C:\\zlib1.dll"); decompress=(int(*)(PBYTE,PULONG,PBYTE,ULONG))GetProcAddress( GetModuleHandle("zlib1

Extract text from pdf using zlib

最后都变了- 提交于 2019-12-20 07:11:09
问题 I am using that function to find a text in the pdf file and replace that text with another text. The problem is when I make inflate and then change the text and deflate, in the final pdf some texts or graphics sometimes are missed. This is an error in my code or zlib library does not support this compression or something? // Open the PDF source file: FILE *pdfFile = fopen([sourceFile cStringUsingEncoding:NSUTF8StringEncoding], "rb"); if (pdfFile) { // Get the file length: int fseekres = fseek

Java decompressing array of bytes

风格不统一 提交于 2019-12-20 03:03:42
问题 On server (C++), binary data is compressed using ZLib function: compress2() and it's sent over to client (Java). On client side (Java), data should be decompressed using the following code snippet: public static String unpack(byte[] packedBuffer) { InflaterInputStream inStream = new InflaterInputStream(new ByteArrayInputStream( packedBuffer); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); int readByte; try { while((readByte = inStream.read()) != -1) { outStream.write(readByte)

ZLib Inflate() failing with -3 Z_DATA_ERROR

╄→гoц情女王★ 提交于 2019-12-19 16:51:03
问题 I am trying to unzip a file by calling the inflate function but it always fails with Z_DATA_ERROR even when I use the example program from the website. I am thinking that maybe the zip file I have is not supported. I have attached a picture of the zip header below. And here is the function that I wrote to perform the unzipping. I read in the whole file at once (about 34KB) and pass it into this function. Note I have tried passing the whole zip file with the zip header as well as skipping over

Error: incorrect header check when running post

纵然是瞬间 提交于 2019-12-19 10:26:42
问题 I need to get zip from rest call (for simulation I use postman with binary option for post and add a little zip file with folder and html file),during the simulation I want to get the data with express and extract the zip and put in some folder under C drive. Currently when I run the following program(this is all the code which i've tried) but im getting error events.js:85 throw er; // Unhandled 'error' event ^ Error: incorrect header check at Zlib._handle.onerror (zlib.js:366:17) var express

linux环境nginx的安装与使用

我只是一个虾纸丫 提交于 2019-12-18 14:29:43
因为公司需要需要安装一系列环境,新手上路第一次配的时候什么也不懂在网上找了半天,觉得这篇不错,我在这里顺便记录一下。 (原文: https://www.cnblogs.com/wyd168/p/6636529.html ) 先复制过来,等有时间了在总结一下自己的方法...... 环境:CentOS-7 ( 以下环境搭建需要安装的建议安装其最新版或者当前最稳定版本!!!! ) -----------------------这是个轮子!!!!!! ----------------------- 开始前,请确认gcc g++开发类库是否装好,默认已经安装。   ububtu平台编译环境可以使用以下指令 apt-get install build-essential apt-get install libtool   centos平台编译环境使用如下指令   安装make: yum -y install gcc automake autoconf libtool make   安装g++: yum install gcc gcc-c++ 下面正式开始: 一、选定安装文件目录   可以选择任何目录,本文选择 cd /usr/local/src cd /usr/local/src 二、安装PCRE库   ftp://ftp.csx.cam.ac.uk/pub/software

Node.js : Specify files to unzip with zlib + tar

我与影子孤独终老i 提交于 2019-12-18 13:14:30
问题 An installation process is downloading a .tar.gz archive, then extract the files to a destination directory. However, not all the files in the archive are required, and I'd like to specify which files should be extracted. The naïve way would be to delete the unnecessary files after extraction, but I'd like a "cleaner" way and filter out instead. Is this possible? The (relevant) code I have so far is (stripped for readability) var fs = require('fs'); var tar = require('tar'); var zlib =

Using zlib with Unicode file paths on Windows

こ雲淡風輕ζ 提交于 2019-12-18 12:30:57
问题 I'm reading gzip compressed files using zlib. Then you open a file using gzFile gzopen(const char *filepath, const char *mode); How do you handle Unicode file paths that are stored as const wchar_t* on Windows? On UNIX-like platforms you can just convert the file path to UTF-8 and call gzopen(), but that will not work on Windows. 回答1: The next version of zlib will include this function where _WIN32 is #defined: gzFile gzopen_w(const wchar_t *path, char *mode); It works exactly like gzopen() ,

What's the proper way to handle back-pressure in a node.js Transform stream?

时光总嘲笑我的痴心妄想 提交于 2019-12-18 11:11:28
问题 Intro These are my first adventures in writing node.js server side. It's been fun so far but I'm having some difficulty understanding the proper way to implement something as it relates to node.js streams. Problem For test and learning purposes I'm working with large files whose content is zlib compressed. The compressed content is binary data, each packet being 38 bytes in length. I'm trying to create a resulting file that looks almost identical to the original file except that there is an

Nginx安装

 ̄綄美尐妖づ 提交于 2019-12-18 07:07:35
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。 ububtu平台编译环境可以使用以下指令 apt-get install build-essential apt-get install libtool centos平台编译环境使用如下指令 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 下面正式开始 一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。 1.选定源码目录 可以是任何目录,本文选定的是/usr/local/src cd /usr/local/src 2.安装PCRE库 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包: cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz tar -zxvf pcre-8.34