Module: Zipping
- Defined in:
- lib/zipping.rb,
lib/zipping/version.rb
Defined Under Namespace
Modules: PKHeader Classes: Entity, Error, StreamMeter, Writer, ZipBuilder
Constant Summary collapse
- ZS_c_pk0102 =
header signatures
0x02014b50
- ZS_c_pk0304 =
0x04034b50
- ZS_c_pk0506 =
0x06054b50
- ZS_c_pk0708 =
0x08074b50
- ZS_c_ver_nocomp =
values for zip version
0x000a
- ZS_c_ver_deflate =
0x0014
- ZS_c_ver_made =
0x0315
- ZS_c_opt_none =
values for option
0x0000
- ZS_c_opt_0708 =
0x0008
- ZS_c_comp_deflate =
compression types
0x0008
- ZS_c_comp_none =
0x0000
- ZS_c_int2_zero =
empty values
0x0000
- ZS_c_int4_zero =
0x00000000
- ZS_c_oattr_dir =
OS-specific attributes (OS X)
0x41ed4000
- ZS_c_oattr_file =
0x81a44000
- ZS_c_oattr_symlink =
0xa1ed4000
- VERSION =
"0.2.5"
Class Method Summary collapse
-
.files_to_zip(output_stream, files, file_division_size = 1048576, encoding = :utf8) ⇒ Object
API methods.
-
.files_to_zipdata(files, encoding = :utf8) ⇒ Object
use if you need to make binary String directly.
-
.files_to_zipfile(path, files, encoding = :utf8) ⇒ Object
use if you need to make File directly.
Class Method Details
.files_to_zip(output_stream, files, file_division_size = 1048576, encoding = :utf8) ⇒ Object
API methods
47 48 49 50 51 52 |
# File 'lib/zipping.rb', line 47 def self.files_to_zip(output_stream, files, file_division_size = 1048576, encoding = :utf8) builder = ZipBuilder.new output_stream, file_division_size, encoding builder.pack files builder.close output_stream end |
.files_to_zipdata(files, encoding = :utf8) ⇒ Object
use if you need to make binary String directly.
60 61 62 |
# File 'lib/zipping.rb', line 60 def self.files_to_zipdata(files, encoding = :utf8) files_to_zip ''.force_encoding('ASCII-8bit'), files, 1048576, encoding end |
.files_to_zipfile(path, files, encoding = :utf8) ⇒ Object
use if you need to make File directly.
55 56 57 |
# File 'lib/zipping.rb', line 55 def self.files_to_zipfile(path, files, encoding = :utf8) File.open(path, 'wb'){|f| files_to_zip f, files, 1048576, encoding} end |