zlib 0.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +31 -4
- data/ext/zlib/extconf.rb +5 -1
- data/ext/zlib/zlib.c +430 -285
- data/zlib.gemspec +16 -4
- metadata +9 -10
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8d957237b697d574370dfb66644eb7912b53f2466929d8ff3ce8690105c99352
|
4
|
+
data.tar.gz: 0e12da7b6b66a599f03288bddbed187ee5c565dc5a21934576b23a6248014e42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b7d6ac7abb5e69c8d9d5dcdf0e9da27147cae4c54e56b147f58174dc44527d17b257faeae348d491aa7e30ef335fb3037a2aacf09989570a3761c74971f35d
|
7
|
+
data.tar.gz: fca7f4d887d1a97fa39ba4a973dfa1785822926df17d309646b97991ecb8d3ea1d6f18607ad5827f3b6fa55ae64715b88dfda5fb81b0385405bbd20451174d98
|
data/README.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Zlib
|
2
2
|
|
3
|
-
|
3
|
+
This module provides access to the [zlib library](http://zlib.net). Zlib is designed to be a portable, free, general-purpose, legally unencumbered -- that is, not covered by any patents -- lossless data-compression library for use on virtually any computer hardware and operating system.
|
4
4
|
|
5
|
-
|
5
|
+
The zlib compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data.
|
6
|
+
|
7
|
+
The zlib compressed data format is described in RFC 1950, which is a wrapper around a deflate stream which is described in RFC 1951.
|
8
|
+
|
9
|
+
The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of IO. The gzip format is described in RFC 1952 which is also a wrapper around a deflate stream.
|
10
|
+
|
11
|
+
The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single-file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib.
|
12
|
+
|
13
|
+
See your system's zlib.h for further information about zlib
|
6
14
|
|
7
15
|
## Installation
|
8
16
|
|
@@ -22,7 +30,26 @@ Or install it yourself as:
|
|
22
30
|
|
23
31
|
## Usage
|
24
32
|
|
25
|
-
|
33
|
+
Using the wrapper to compress strings with default parameters is quite simple:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require "zlib"
|
37
|
+
|
38
|
+
data_to_compress = File.read("don_quixote.txt")
|
39
|
+
|
40
|
+
puts "Input size: #{data_to_compress.size}"
|
41
|
+
#=> Input size: 2347740
|
42
|
+
|
43
|
+
data_compressed = Zlib::Deflate.deflate(data_to_compress)
|
44
|
+
|
45
|
+
puts "Compressed size: #{data_compressed.size}"
|
46
|
+
#=> Compressed size: 887238
|
47
|
+
|
48
|
+
uncompressed_data = Zlib::Inflate.inflate(data_compressed)
|
49
|
+
|
50
|
+
puts "Uncompressed data is: #{uncompressed_data}"
|
51
|
+
#=> Uncompressed data is: The Project Gutenberg EBook of Don Quixote...
|
52
|
+
```
|
26
53
|
|
27
54
|
## Development
|
28
55
|
|
@@ -37,4 +64,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/z
|
|
37
64
|
|
38
65
|
## License
|
39
66
|
|
40
|
-
The gem is available as open source under the terms of the [
|
67
|
+
The gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).
|
data/ext/zlib/extconf.rb
CHANGED
@@ -31,9 +31,12 @@ else
|
|
31
31
|
$extso << dll
|
32
32
|
$cleanfiles << "$(topdir)/#{dll}" << "$(ZIMPLIB)"
|
33
33
|
zmk = "\t$(MAKE) -f $(ZMKFILE) TOP=$(ZSRC)"
|
34
|
+
zopts = []
|
34
35
|
if $nmake
|
35
36
|
zmkfile = "$(ZSRC)/win32/Makefile.msc"
|
36
37
|
m = "#{zsrc}/win32/Makefile.msc"
|
38
|
+
# zopts << "USE_ASM=1"
|
39
|
+
zopts << "ARCH=#{RbConfig::CONFIG['target_cpu']}"
|
37
40
|
else
|
38
41
|
zmkfile = "$(ZSRC)/win32/Makefile.gcc"
|
39
42
|
m = "#{zsrc}/win32/Makefile.gcc"
|
@@ -55,9 +58,10 @@ else
|
|
55
58
|
addconf.push(
|
56
59
|
"ZMKFILE = #{zmkfile}\n",
|
57
60
|
"ZIMPLIB = #{zimplib}\n",
|
61
|
+
"ZOPTS = #{zopts.join(' ')}\n",
|
58
62
|
"$(TARGET_SO): $(ZIMPLIB)\n",
|
59
63
|
"$(ZIMPLIB):\n",
|
60
|
-
"#{zmk} $@\n",
|
64
|
+
"#{zmk} $(ZOPTS) $@\n",
|
61
65
|
"install-so: $(topdir)/#{dll}",
|
62
66
|
"$(topdir)/#{dll}: $(ZIMPLIB)\n",
|
63
67
|
"\t$(Q) $(COPY) #{dll} $(@D)\n",
|