Sign in Join
Wiki copytemporary

Zlibar: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Zlibar

OldNewLine
1+# About
2+
3+**zlibar** is a unit that contains components to create a single compressed file archive that contains many files. It uses paszlib that is included with FreePascal so there are no external library requirements
4+
5+The two main components are :
6+
7+- TZlibWriteArchive - Used to create an archive
8+- TZlibReadArchive - Used to read the archive and extract it's files
9+
10+Features of TZlibWriteArchive :
11+
12+- Create the Archive file in a stream, allowing you to save it to a file or do something else creative with it
13+- Each file in the archive is stored with a MD5 checksum
14+- Each file can be stored with a relative path
15+- Contains progress [[callback|callbacks]] to inform the program of the current file and all files progress
16+
17+Features of TZlibReadArchive :
18+
19+- Loads the archive from a TStream.
20+- Contains a progress callback to inform the program of the extraction progress
21+- Files in the archive are extractable by an index number and are extracted to a TStream
22+
23+The download contains a demo program, and the unit. Also a package file.
24+
25+Although not tested, it should work on any platform.
26+
27+**Changes in versions** :
28+
29+0.2.3 (19/02/2012)
30+
31+- Fixed compilation with newer versions of fpc
32+
33+0.2.2
34+
35+- LCL requirement removed
36+- FPC version 2.0.4 (or a recent development version) required.
37+- Compatible with FPC 2.0.4 ( go figure.... ;)
38+
39+0.2.1
40+
41+- archives should work across different endian machines now.
42+- fixed bad memory corruption bug
43+- now requires LCL for endian safeness
44+
45+# Author
46+
47+Andrew Haines
48+
49+# License
50+
51+zlibar.pas is distributed with the same modified LGPL as the LCL, so it is possible to use it in proprietary programs without disclosing your source.
52+
53+# Download
54+
55+## Releases
56+
57+The latest stable release can be found on the [Lazarus CCR Files page](http://sourceforge.net/projects/lazarus-ccr/files/ZlibAr/).
58+
59+## Subversion
60+
61+zlibar is available in the lazarus code and component repository since version 0.2.3:
62+
63+` svn co `[`https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/zlibar`](https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/zlibar)` zlibar`
64+
65+# Dependencies / System Requirements
66+
67+- Free Pascal
68+- Demo Program requires Lazarus
69+
70+Issues:
71+
72+- Tested on Linux.
73+- Needs testing on Windows. *Confirmed working on Windows*\
74+ --Eyecreate 03:22, 23 February 2007 (CET)
75+
76+Version 0.2.2 will not compile on newer versions of fpc (\>2.4.2) Use a version newer than 0.2.2 or subversion.
77+
78+# Usage
79+
80+Add the unit "zlibar" to your uses section.
81+
82+## TZLibWriteArchive
83+
84+Example:
85+
86+``` pascal
87+var
88+ Zar: TZlibWriteArchive;
89+ Stream: TMemoryStream;
90+ X: Integer;
91+begin
92+ Stream := TMemoryStream.Create;
93+ Zar := TZlibWriteArchive.Create;
94+ Zar.OutStream := Stream;
95+
96+ Zar.InputFiles.Add('/path/to/MyFileName1');
97+ Zar.InputFiles.Add('/path/to/MyFileName2');
98+
99+ Zar.CreateArchive;
100+
101+ Stream.SaveToFile('MySavedFileName');
102+ Zar.Free;
103+ Stream.Free;
104+end;
105+```
106+
107+## TZlibReadArchive
108+
109+Example:
110+
111+``` pascal
112+var
113+ ArchStream: TMemoryStream;
114+ FileStream: TMemoryStream;
115+ ZReadArc: TZlibReadArchive;
116+ X: Integer;
117+ DestPath: String;
118+begin
119+ ArchStream := TMemoryStream.Create;
120+ FileStream := TmemoryStream.Create;
121+
122+ ArchStream.LoadFromFile('ArchiveFileName');
123+ ZReadArc:= TZlibReadArchive.Create(ArchStream);
124+ DestPath := '/Some/Path';
125+ for X := 0 to ZReadArc.Count -1 do begin
126+ ZReadArc.ExtractFileToStream(X, FileStream);
127+ FileStream.SaveToFile(DestPath+ZReadArc.FilesInArchive[X].FilePath+'/'+ZReadArc.FilesInArchive[X].FIleName);
128+ FileStream.Position := 0;
129+ FileStream.Size := 0;
130+ end;
131+ ZReadArc.Free;
132+ ArchStream.Free;
133+ FileStream.Free;
134+end;
135+```
136+
137+---
138+*From the Free Pascal wiki, page "Zlibar", as it stood on 2021-10-25 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history