class Zip::FileSource

Overview

Use file as a source for an Archive#add or Archive#replace.

Example

# create file source
source = FileSource.new(zip, "/path/to/file.txt")

# add file to archive as "foo.txt"
zip.add("foo.txt", source)

Defined in:

zip/sources.cr

Constructors

Instance methods inherited from class Zip::Source

to_unsafe : LibZip::ZipSourceT to_unsafe

Constructor Detail

def self.new(archive : Archive, fname : String, offset : UInt64 = 0_u64, len : Int64 = -1) #

Create file source for an Archive#add or Archive#replace.

Raises an exception if FileSource could not be created.

Example

# create file source
source = FileSource.new(zip, "/path/to/file.txt")

# add file to archive as "foo.txt"
zip.add("foo.txt", source)

[View source]