ddn.archive.zip
ddn.archive.zip
ZIP archive reader and writer implementing ddn.api.archive.
Copyright
Module Initializers 1
()Types 4
Delegate type for streaming byte source.
Called by ZipStreamReader to request more data from the underlying non-seekable source. The delegate should fill the provided buffer with available bytes.
Parameters
buffer | The buffer to fill with data. |
Returns
void setProgressCallback(ArchiveProgressCallback callback)bool contains(string path)void readContent(const EntryInfo entry, ContentSink sink)void extractAll(string destDir)void close()this(const(ubyte)[] data, ReadOptions opts)Zip64EocdTrue streaming ZIP reader that reads entries incrementally from a non-seekable source.
Unlike ZipReader which loads the entire archive and parses the central directory, ZipStreamReader reads local file headers sequentially, allowing processing of archives from pipes, sockets, or other non-seekable sources without buffering the entire archive in memory.
Limitations compared to ZipReader:
- No random access (
getEntry()is not supported) entryCount()returns 0 (unknown until fully read)contains()requires sequential scan- Cannot seek backwards to re-read entries
The reader handles both regular ZIP entries and entries with data descriptors (general purpose bit flag 3), as well as ZIP64 extended information.
ArchiveCapabilities capabilities() @property constReturns the provider capabilities for streaming mode.void setProgressCallback(ArchiveProgressCallback callback)Set progress callback for operation monitoring.bool contains(string path)Check if archive contains an entry at path.void readContent(const EntryInfo entry, ContentSink sink)Read entry content, calling sink with chunks of decompressed data.void extractAll(string destDir)Extract all entries to a directory.void close()Close the reader and release resources.this(ByteSource source, ReadOptions opts)Construct a streaming ZIP reader.StreamEntryStatevoid setOutputSink(ContentSink sink)void setProgressCallback(ArchiveProgressCallback callback)void addDirectory(string path,
FilePermissions perms = FilePermissions.fromOctal(octal!"755"))void addFile(string path, const(ubyte)[] content,
EntryWriteOptions opts = EntryWriteOptions.init)void addFile(string path, scope const(ubyte)[] delegate() source,
ulong size = 0, EntryWriteOptions opts = EntryWriteOptions.init)void addFileFrom(string archivePath, string filesystemPath,
EntryWriteOptions opts = EntryWriteOptions.init)void addSymlink(string path, string target)void addHardlink(string path, string target)void setComment(string comment)void removeEntry(string path)void updateEntry(string path, const(ubyte)[] content,
EntryWriteOptions opts = EntryWriteOptions.init)void finish()void close()this(ContentSink sink, WriteOptions opts)Functions 4
ArchiveReader makeZipReader(const(ubyte)[] data, ReadOptions opts)Create a ZipReader for reading from an in-memory buffer.ArchiveReader makeZipStreamReader(ByteSource source, ReadOptions opts)Create a ZipStreamReader for reading from a streaming byte source.ArchiveWriter makeZipWriter(ContentSink sink, WriteOptions opts)Create a ZipWriter for writing to an output sink.ArchiveFormat detectZipFormat(const(ubyte)[] header)