From 25199ab4c29057d7c0a73812fc8f2ac3605c1d86 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 10 Aug 2016 21:04:41 -0400 Subject: add documentation --- Zip/Archive.html | 472 ++++++++++++++++++++++ Zip/CompressionMethod.html | 815 ++++++++++++++++++++++++++++++++++++++ Zip/DeflateCompressionHelper.html | 191 +++++++++ Zip/Entry.html | 636 +++++++++++++++++++++++++++++ Zip/Error.html | 179 +++++++++ Zip/Extra.html | 370 +++++++++++++++++ Zip/GeneralFlags.html | 649 ++++++++++++++++++++++++++++++ Zip/NoneCompressionHelper.html | 165 ++++++++ Zip/Source.html | 335 ++++++++++++++++ Zip/TimeHelper.html | 165 ++++++++ Zip/Version.html | 312 +++++++++++++++ Zip/Writer.html | 389 ++++++++++++++++++ Zip/WriterEntry.html | 319 +++++++++++++++ 13 files changed, 4997 insertions(+) create mode 100644 Zip/Archive.html create mode 100644 Zip/CompressionMethod.html create mode 100644 Zip/DeflateCompressionHelper.html create mode 100644 Zip/Entry.html create mode 100644 Zip/Error.html create mode 100644 Zip/Extra.html create mode 100644 Zip/GeneralFlags.html create mode 100644 Zip/NoneCompressionHelper.html create mode 100644 Zip/Source.html create mode 100644 Zip/TimeHelper.html create mode 100644 Zip/Version.html create mode 100644 Zip/Writer.html create mode 100644 Zip/WriterEntry.html (limited to 'Zip') diff --git a/Zip/Archive.html b/Zip/Archive.html new file mode 100644 index 0000000..ea6e914 --- /dev/null +++ b/Zip/Archive.html @@ -0,0 +1,472 @@ + + + + + + + + Zip::Archive - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Archive + +

+ + + + + + + +

Overview

+ +

Input archive.

+ +

Use Zip.read() instead of instantiating this class directly.

+ + + + + +

Included Modules

+ + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(io : Source) + + # +
+ +

Create new Zip::Archive from input Zip::Source.

+ +

Use Zip.read() instead of calling this method directly.

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def [](path : String) : Entry + + # +
+ +

Get Zip::Entry by path.

+ +

Example:

+ +

# get bar.txt and read it into memory io +io = MemoryIO.new +zip["bar.txt"].read(io)

+ +
+
+ +
+
+ +
+
+ + def [](id : Int) : Entry + + # +
+ +

Get Zip::Entry by number.

+ +

Example:

+ +

# read third entry from archive into memory io +io = MemoryIO.new +zip[2].read(io)

+ +
+
+ +
+
+ +
+
+ + def []?(id : Int) : Entry | Nil + + # +
+ +

Get Zip::Entry by number, or nil if it doesn't exist

+ +

Example:

+ +

# read third entry from archive into memory io +if e = zip[2] +io = MemoryIO.new +e.read(io) +end

+ +
+
+ +
+
+ +
+
+ + def []?(path : String) : Entry | Nil + + # +
+ +

Return Zip::Entry from path, or nil if it doesn't exist.

+ +

Example:

+ +

# read bar.txt into memory io if it exists +if e = zip["bar.txt"]? +io = MemoryIO.new +e.read(io) +end

+ +
+
+ +
+
+ +
+
+ + def comment : String + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options, &block) + + # +
+ +
+
+ +
+
+ +
+
+ + def each(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def entries : Array(Zip::Entry) + + # +
+ +
+
+ +
+
+ +
+
+ + def size(*args, **options, &block) + + # +
+ +
+
+ +
+
+ +
+
+ + def size(*args, **options) + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/CompressionMethod.html b/Zip/CompressionMethod.html new file mode 100644 index 0000000..f18b338 --- /dev/null +++ b/Zip/CompressionMethod.html @@ -0,0 +1,815 @@ + + + + + + + + Zip::CompressionMethod - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + enum Zip::CompressionMethod + +

+ + + + + +

Overview

+ +

Compression methods.

+ + + + + + + + + + + + + + +

Defined in:

+ + + + + +

Enum Members

+ +
+ +
+ NONE = 0 +
+ +
+

Stored (no compression)

+
+ + +
+ SHRUNK = 1 +
+ +
+

Shrunk

+
+ + +
+ REDUCED_1 = 2 +
+ +
+

Reduced with compression factor 1

+
+ + +
+ REDUCED_2 = 3 +
+ +
+

Reduced with compression factor 2

+
+ + +
+ REDUCED_3 = 4 +
+ +
+

Reduced with compression factor 3

+
+ + +
+ REDUCED_4 = 5 +
+ +
+

Reduced with compression factor 4

+
+ + +
+ IMPLODED = 6 +
+ +
+

Imploded

+
+ + +
+ TOKENIZED = 7 +
+ +
+

Reserved for Tokenizing compression algorithm

+
+ + +
+ DEFLATE = 8 +
+ +
+

Deflated

+
+ + +
+ DEFLATE64 = 9 +
+ +
+

Enhanced Deflating using Deflate64(tm)

+
+ + +
+ TERSE_OLD = 10 +
+ +
+

PKWARE Data Compression Library Imploding (old IBM TERSE)

+
+ + +
+ RESERVED_11 = 11 +
+ +
+

Reserved by PKWARE

+
+ + +
+ BZIP2 = 12 +
+ +
+

BZIP2

+
+ + +
+ RESERVED_13 = 13 +
+ +
+

Reserved by PKWARE

+
+ + +
+ LZMA = 14 +
+ +
+

LZMA (EFS)

+
+ + +
+ RESERVED_15 = 15 +
+ +
+

Reserved by PKWARE

+
+ + +
+ RESERVED_16 = 16 +
+ +
+

Reserved by PKWARE

+
+ + +
+ RESERVED_17 = 17 +
+ +
+

Reserved by PKWARE

+
+ + +
+ TERSE = 18 +
+ +
+

IBM TERSE (new)

+
+ + +
+ LZ77 = 19 +
+ +
+

IBM LZ77 z Architecture (PFS)

+
+ + +
+ WAVPACK = 97 +
+ +
+

WavPack compressed data

+
+ + +
+ PPMD = 98 +
+ +
+

PPMd version I, Rev 1

+
+ + +
+ + + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

Instance Method Detail

+ +
+
+ + def bzi_p2? + + # +
+ +
+
+ +
+
+ +
+
+ + def deflat_e64? + + # +
+ +
+
+ +
+
+ +
+
+ + def deflate? + + # +
+ +
+
+ +
+
+ +
+
+ + def imploded? + + # +
+ +
+
+ +
+
+ +
+
+ + def l_z77? + + # +
+ +
+
+ +
+
+ +
+
+ + def lzma? + + # +
+ +
+
+ +
+
+ +
+
+ + def none? + + # +
+ +
+
+ +
+
+ +
+
+ + def ppmd? + + # +
+ +
+
+ +
+
+ +
+
+ + def reduced_1? + + # +
+ +
+
+ +
+
+ +
+
+ + def reduced_2? + + # +
+ +
+
+ +
+
+ +
+
+ + def reduced_3? + + # +
+ +
+
+ +
+
+ +
+
+ + def reduced_4? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_11? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_13? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_15? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_16? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_17? + + # +
+ +
+
+ +
+
+ +
+
+ + def shrunk? + + # +
+ +
+
+ +
+
+ +
+
+ + def terse? + + # +
+ +
+
+ +
+
+ +
+
+ + def terse_old? + + # +
+ +
+
+ +
+
+ +
+
+ + def tokenized? + + # +
+ +
+
+ +
+
+ +
+
+ + def wavpack? + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/DeflateCompressionHelper.html b/Zip/DeflateCompressionHelper.html new file mode 100644 index 0000000..0b42f24 --- /dev/null +++ b/Zip/DeflateCompressionHelper.html @@ -0,0 +1,191 @@ + + + + + + + + Zip::DeflateCompressionHelper - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + module Zip::DeflateCompressionHelper + +

+ + + + + +

Overview

+ +

Helper methods for compressing and decompressing deflated data.

+ + + + + + + + + + + +

Direct including types

+ + + + + +

Defined in:

+ + + + + +

Constant Summary

+ +
+ +
+ ZALLOC_PROC = LibZ::AllocFunc.new do |data, num_items, size| + GC.malloc(num_items * size) +end +
+ + +
+ ZFREE_PROC = LibZ::FreeFunc.new do |data, addr| + GC.free(addr) +end +
+ + +
+ ZLIB_VERSION = LibZ.zlibVersion +
+ + +
+ + + + + + + + + +
+ +
+ + + + + + + +
+ + + diff --git a/Zip/Entry.html b/Zip/Entry.html new file mode 100644 index 0000000..6626777 --- /dev/null +++ b/Zip/Entry.html @@ -0,0 +1,636 @@ + + + + + + + + Zip::Entry - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Entry + +

+ + + + + + + +

Overview

+ +

File entry in Archive.

+ +

Use Zip.read() to read a Zip archive, then #[] to fetch a +specific archive entry.

+ +

Example:

+ +

# create MemoryIO +io = MemoryIO.new

+ +

# open "foo.zip" +Zip.read("foo.zip") do |zip| +# get "bar.txt" entry from "foo.zip" +e = zip["bar.txt"]

+ +
# read contents of "bar.txt" into io
+e.read(io)
+ +

end

+ + + + + +

Included Modules

+ + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(io : Source) + + # +
+ +

Instantiate a new Entry object from the given IO.

+ +

You should not need to call this method directly (use +Zip::Archive#[] instead).

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def comment : String + + # +
+ +
+
+ +
+
+ +
+
+ + def compressed_size : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def crc : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def external_attr : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def extras : Array(Zip::Extra) + + # +
+ +
+
+ +
+
+ +
+
+ + def flags : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def internal_attr : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def local_extras : Array(Extra) + + # +
+ +

Returns an array of Extra attributes for this Entry.

+ +

Zip archives can (and do) have separate Extra attributes +associated with the file entry itself, and the file's entry in the +Central Directory.

+ +

The #extras method returns the Extra attributes from the +file's entry in the Central Directory, and this method returns the +Extra data from the file entry itself.

+ +

Example:

+ +

# open "./foo.zip" +Zip.read("./foo.zip") do |zip| +# get array of local extra attributes from "bar.txt" +extras = zip["bar.txt"].local_extras +end

+ +
+
+ +
+
+ +
+
+ + def method : Zip::CompressionMethod + + # +
+ +
+
+ +
+
+ +
+
+ + def path : String + + # +
+ +
+
+ +
+
+ +
+
+ + def pos : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def read(dst_io : IO) : UInt32 + + # +
+ +

Write contents of Entry into given IO.

+ +

Raises an Error if the file contents could not be read or if the +compression method is unsupported.

+ +

Example:

+ +

# open "output-bar.txt" for writing +File.open("output-bar.txt", "wb") do |io| +# open archive "./foo.zip" +Zip.read("foo.zip") do |zip| +# write contents of "bar.txt" to "output-bar.txt" +zip["foo.txt"].read(io) +end +end

+ +
+
+ +
+
+ +
+
+ + def size : UInt32 + + # +
+ +

Return the uncompressed size of this entry in bytes.

+ +

Example:

+ +

Zip.read("foo.zip") do |zip| +size = zip["bar.txt"].size +puts "bar.txt is #{size} bytes." +end

+ +
+
+ +
+
+ +
+
+ + def time : Time + + # +
+ +
+
+ +
+
+ +
+
+ + def uncompressed_size : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def version : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def version_needed : UInt16 + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/Error.html b/Zip/Error.html new file mode 100644 index 0000000..fc71ef7 --- /dev/null +++ b/Zip/Error.html @@ -0,0 +1,179 @@ + + + + + + + + Zip::Error - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Error + +

+ + + + + + + +

Overview

+ +

Wrapper class for exceptions.

+ + + + + + + + + + + + + + +

Defined in:

+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + diff --git a/Zip/Extra.html b/Zip/Extra.html new file mode 100644 index 0000000..cb489df --- /dev/null +++ b/Zip/Extra.html @@ -0,0 +1,370 @@ + + + + + + + + Zip::Extra - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Extra + +

+ + + + + + + +

Overview

+ +

Extra data associated with Entry.

+ +

You should not need to instantiate this class directly; use +Zip::Entry#extras or Zip::Entry#local_extras instead.

+ +

Example:

+ +

# open "foo.zip" +Zip.read("foo.zip") do |zip| +# get extra data associated with "bar.txt" +extras = zip["bar.txt"].extras +end

+ + + + + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(code : UInt16, data : Bytes) + + # +
+ +
+
+ +
+
+ +
+
+ + def self.new(io) + + # +
+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def code : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def code=(code) + + # +
+ +
+
+ +
+
+ +
+
+ + def data : Slice(UInt8) + + # +
+ +
+
+ +
+
+ +
+
+ + def data=(data) + + # +
+ +
+
+ +
+
+ +
+
+ + def size(*args, **options, &block) + + # +
+ +
+
+ +
+
+ +
+
+ + def size(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def to_s(io) : UInt32 + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/GeneralFlags.html b/Zip/GeneralFlags.html new file mode 100644 index 0000000..4831e42 --- /dev/null +++ b/Zip/GeneralFlags.html @@ -0,0 +1,649 @@ + + + + + + + + Zip::GeneralFlags - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + enum Zip::GeneralFlags + +

+ + + + + +

Overview

+ +

General flags.

+ +

Used by local header and central directory header.

+ + + + + + + + + + + + + + +

Defined in:

+ + + + + +

Enum Members

+ +
+ +
+ ENCRYPTION = 1 +
+ +
+

encrypted using weak encryption

+
+ + +
+ COMPRESSION_OPTION_1 = 2 +
+ +
+

compression method-specific flag

+
+ + +
+ COMPRESSION_OPTION_2 = 4 +
+ +
+

compression method-specific flag

+
+ + +
+ FOOTER = 8 +
+ +
+

this entry has a data descriptor footer

+
+ + +
+ RESERVED_4 = 16 +
+ +
+

reserved flag

+
+ + +
+ PATCH = 32 +
+ +
+

this entry is patch data

+
+ + +
+ STRONG_ENCRYPTION = 64 +
+ +
+

this entry uses strong encryption

+
+ + +
+ RESERVED_7 = 128 +
+ +
+

reserved flag

+
+ + +
+ RESERVED_8 = 256 +
+ +
+

reserved flag

+
+ + +
+ RESERVED_9 = 512 +
+ +
+

reserved flag

+
+ + +
+ RESERVED_10 = 1024 +
+ +
+

reserved flag

+
+ + +
+ EFS = 2048 +
+ +
+

the file name and comment for this entry are UTF-8 encoded.

+
+ + +
+ RESERVED_12 = 4096 +
+ +
+

reserved flag

+
+ + +
+ MASKED_VALUES = 8192 +
+ +
+

Some fields in the local header are masked (that is, empty).

+
+ + +
+ RESERVED_14 = 16384 +
+ +
+

reserved flag

+
+ + +
+ RESERVED_15 = 32768 +
+ +
+

reserved flag

+
+ + +
+ + + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

Instance Method Detail

+ +
+
+ + def compression_option_1? + + # +
+ +
+
+ +
+
+ +
+
+ + def compression_option_2? + + # +
+ +
+
+ +
+
+ +
+
+ + def efs? + + # +
+ +
+
+ +
+
+ +
+
+ + def encryption? + + # +
+ +
+
+ +
+
+ +
+
+ + def footer? + + # +
+ +
+
+ +
+
+ +
+
+ + def masked_values? + + # +
+ +
+
+ +
+
+ +
+
+ + def patch? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_10? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_12? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_14? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_15? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_4? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_7? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_8? + + # +
+ +
+
+ +
+
+ +
+
+ + def reserved_9? + + # +
+ +
+
+ +
+
+ +
+
+ + def strong_encryption? + + # +
+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/NoneCompressionHelper.html b/Zip/NoneCompressionHelper.html new file mode 100644 index 0000000..f508f52 --- /dev/null +++ b/Zip/NoneCompressionHelper.html @@ -0,0 +1,165 @@ + + + + + + + + Zip::NoneCompressionHelper - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + module Zip::NoneCompressionHelper + +

+ + + + + +

Overview

+ +

Helper methods for reading and writing uncompressed data.

+ + + + + + + + + + + +

Direct including types

+ + + + + +

Defined in:

+ + + + + + + + + + + + +
+ +
+ + + + + + + +
+ + + diff --git a/Zip/Source.html b/Zip/Source.html new file mode 100644 index 0000000..6c94cbc --- /dev/null +++ b/Zip/Source.html @@ -0,0 +1,335 @@ + + + + + + + + Zip::Source - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Source + +

+ + + + + + + +

Overview

+ +

Base class for input source for Archive object.

+ +

You should not need to instantiate this class directly; use +Zip.read() instead.

+ + + + + +

Included Modules

+ + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + +

Macro Summary

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(io : IO::FileDescriptor | MemoryIO) + + # +
+ +

Instantiate a new Source from the given IO::FileDescriptor or +MemoryIO object.

+ +

You should not need to instantiate this class directly; use +Zip.read() instead.

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def read(*args, **options, &block) + + # +
+ +
+
+ +
+
+ +
+
+ + def read(*args, **options) + + # +
+ +
+
+ +
+
+ +
+
+ + def write(*args, **options, &block) + + # +
+ +
+
+ +
+
+ +
+
+ + def write(*args, **options) + + # +
+ +
+
+ +
+
+ + + + +

Macro Detail

+ +
+
+ + macro method_missing(call) + + # +
+ +
+
+ +
+
+ + + +
+ + + diff --git a/Zip/TimeHelper.html b/Zip/TimeHelper.html new file mode 100644 index 0000000..ed3ffad --- /dev/null +++ b/Zip/TimeHelper.html @@ -0,0 +1,165 @@ + + + + + + + + Zip::TimeHelper - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + module Zip::TimeHelper + +

+ + + + + +

Overview

+ +

Helper methods for converting to and from Time objects.

+ + + + + + + + + + + +

Direct including types

+ + + + + +

Defined in:

+ + + + + + + + + + + + +
+ +
+ + + + + + + +
+ + + diff --git a/Zip/Version.html b/Zip/Version.html new file mode 100644 index 0000000..a555534 --- /dev/null +++ b/Zip/Version.html @@ -0,0 +1,312 @@ + + + + + + + + Zip::Version - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Version + +

+ + + + + + + +

Overview

+ +

Version identifier used to identify the version needed to extract a +given file and to indicate the format of the external file +attributes.

+ +

See section 4.4.3.2 of APPNOTE.TXT for version details.

+ + + + + + + + + + + + + + +

Defined in:

+ + + + + +

Constant Summary

+ +
+ +
+ DEFAULT = new(0, 0) +
+ +
+

Default version made by, if unspecified.

+
+ + +
+ NEEDED = new(2, 0) +
+ +
+

Version needed to extract this entry (4.4.3.2).

+
+ + +
+ + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(major : Int32, minor : Int32, compat : Int32 = 0) + + # +
+ +

Create a version identifier from a major number, minor number, and +optional compatability number.

+ +
+
+ +
+
+ +
+
+ + def self.new(v : UInt16) + + # +
+ +

Create a version identifier from a major number, minor number, and +optional compatability number.

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def to_io(io) + + # +
+ +

Write version as 16-bit, little-endian integer and return number +of bytes written.

+ +
+
+ +
+
+ +
+
+ + def to_s(io) + + # +
+ +

Write version as string.

+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/Writer.html b/Zip/Writer.html new file mode 100644 index 0000000..c28c13e --- /dev/null +++ b/Zip/Writer.html @@ -0,0 +1,389 @@ + + + + + + + + Zip::Writer - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Writer + +

+ + + + + + + + + + + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(io : IO, pos : UInt32 = 0, comment : String = "", version : Version = Version::DEFAULT) + + # +
+ +

Create a new Writer object.

+ +

You shouldn't need to instantiate this class directly; use +Zip.write() instead.

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def add(path : String, io : IO, method : CompressionMethod = CompressionMethod::DEFLATE, time : Time = Time.now, comment : String = "") : UInt32 + + # +
+ +

Read data from IO io, write it to path in archive, then +return the number of bytes written.

+ +

Example:

+ +

# create IO from "/path/to/bar.txt" +File.open("/path/to/bar.txt, "rb") do |io| +# write to "foo.zip" +Zip.write("foo.zip") do |zip| +# add "bar.txt" with contents of given IO +zip.add("bar.txt", io) +end +end

+ +
+
+ +
+
+ +
+
+ + def add(path : String, data : String | Bytes, method : CompressionMethod = CompressionMethod::DEFLATE, time : Time = Time.now, comment : String = "") : UInt32 + + # +
+ +

Write data to path in archive and return number of bytes +written.

+ +

Example:

+ +

# write to "foo.zip" +Zip.write("foo.zip") do |zip| +# add "bar.txt" with contents "hello!" +zip.add("bar.txt", "hello!") +end

+ +
+
+ +
+
+ +
+
+ + def add_file(path : String, file_path : String, method : CompressionMethod = CompressionMethod::DEFLATE, time : Time = Time.now, comment : String = "") : UInt32 + + # +
+ +

Add local file file_path to archive as path and return number +of bytes written.

+ +

Example:

+ +

# write to "foo.zip" +Zip.write("foo.zip") do |zip| +# add local file "/path/to/bar.txt" as "bar.txt" +zip.add_file("bar.txt", "/path/to/bar.txt") +end

+ +
+
+ +
+
+ +
+
+ + def bytes_written : UInt32 + + # +
+ +

Return the total number of bytes written so far.

+ +

Example:

+ +

Zip.write("foo.zip") do |zip| +# add "bar.txt" +zip.add_file("bar.txt", "/path/to/bar.txt")

+ +
# print number of bytes written so far
+puts "bytes written so far: #{zip.bytes_written}"
+ +

end

+ +
+
+ +
+
+ +
+
+ + def close + + # +
+ +

Close this writer and return the total number of bytes written.

+ +
+
+ +
+
+ +
+
+ + def closed? : Bool + + # +
+ +

Is this Writer closed?

+ +
+
+ +
+
+ + + + + +
+ + + diff --git a/Zip/WriterEntry.html b/Zip/WriterEntry.html new file mode 100644 index 0000000..843b04b --- /dev/null +++ b/Zip/WriterEntry.html @@ -0,0 +1,319 @@ + + + + + + + + Zip::WriterEntry - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::WriterEntry + +

+ + + + + + + +

Overview

+ +

Internal class used to store files for Writer instance.

+ +

You should not need to instantiate this class directly; it is called +automatically by Writer#add and Writer#add_file.

+ + + + + +

Included Modules

+ + + + + + + + + + + +

Defined in:

+ + + + + +

Constant Summary

+ +
+ +
+ GENERAL_FLAGS = GeneralFlags.flags(FOOTER, EFS) +
+ +
+

Default flags for local and central header.

+
+ + +
+ + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(pos : UInt32, path : String, io : IO, method : CompressionMethod = CompressionMethod::DEFLATE, time : Time = Time.now, comment : String = "") + + # +
+ +

Create a new WriterEntry instance.

+ +

You should not need to call this method directly; it is called +automatically by Writer#add and Writer#add_file.

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def to_s(dst_io) : UInt32 + + # +
+ +

Write local file entry to IO and return the number of bytes +written.

+ +

You should not need to call this method directly; it is called +automatically by Writer#add and Writer#add_file.

+ +
+
+ +
+
+ +
+
+ + def write_central(io : IO, version : Version = Version::DEFAULT) : UInt32 + + # +
+ +

Write central directory data for this WriterEntry and return the +number of bytes written.

+ +

You should not need to call this method directly; it is called +automatically by Writer#close.

+ +
+
+ +
+
+ + + + + +
+ + + -- cgit v1.2.3