/ Vendor / ZipStream / ZipStream.php
Defined Classes
ZipStream Class Info:
- Class Declaration:
class ZipStream
- File name:
- Vendor/ZipStream/ZipStream.php
- Description:
Class to create zip file, aimed at large files, or even large target zip file. This class will stream the generated zip file directly to the HTTP client as the content is added.
If you need the Zip file data on the server, for storage in a database of the server file system, look at the Zip class at http://www.phpclasses.org/browse/package/6110.html License: GNU LGPL, Attribution required for commercial implementations, requested for everything else.
Inspired on CreateZipFile by Rochak Chauhan www.rochakchauhan.com (http://www.phpclasses.org/browse/package/2322.html) and http://www.pkware.com/documents/casestudies/APPNOTE.TXT Zip file specification.
- Author
A. Grandt
- Copyright
A. Grandt 2010-2011
- License
GNU LGPL, Attribution required for commercial implementations, requested for everything else.
- Link
- http://www.phpclasses.org/package/6616
- Version
1.25
Properties:
-
cdRec
-
centralFileHeader
-
endOfCentralDirectory
-
isFinalized
-
localFileHeader
-
offset
-
streamChunkSize
-
streamComment
-
streamData
-
streamFile
-
streamFileLength
-
streamFilePath
-
streamTimeStamp
-
zipComment
-
zipMemoryThreshold
Method Summary:
- addDirectory( $directoryPath, $timestamp = 0, $fileComment = NULL )
- addDirectoryContent( $realPath, $zipPath, $recursive = true )
- addFile( $data, $filePath, $timestamp = 0, $fileComment = NULL )
- addLargeFile( $dataFile, $filePath, $timestamp = 0, $fileComment = NULL )
- addStreamData( $data )
- buildZipEntry( $filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr )
- closeStream( )
- __construct( $archiveName = '', $contentType = 'application/zip' )
- __destruct( )
- finalize( )
- getDosTime( $timestamp = 0 )
- getRelativePath( $path )
- openStream( $filePath, $timestamp = 0, $fileComment = NULL )
- pathJoin( $dir, $file )
- setComment( $newComment = NULL )
addDirectory
topAdd an empty directory entry to the zip archive. Basically this is only used if an empty directory is added.
- Parameters:
-
-
string $directoryPath required
Directory Path and name to be added to the archive.
-
int $timestamp optional 0
(Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used.
-
string $fileComment optional NULL
(Optional) Comment to be added to the archive for this directory. To use fileComment, timestamp must be given.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
addDirectoryContent
topAdd the content to a directory.
- Parameters:
-
-
String $realPath required
Path on the file system.
-
bool $zipPath required
Add content recursively, default is TRUE.
-
$recursive optional true
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Author
Adam Schmalhofer <Adam.Schmalhofer@gmx.de>
A. Grandt
addFile
topAdd a file to the archive at the specified location and file name.
- Parameters:
-
-
string $data required
File data.
-
string $filePath required
Filepath and name to be used in the archive.
-
int $timestamp optional 0
(Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
-
string $fileComment optional NULL
(Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
addLargeFile
topAdd a file to the archive at the specified location and file name.
- Parameters:
-
-
string $dataFile required
File name/path.
-
string $filePath required
Filepath and name to be used in the archive.
-
int $timestamp optional 0
(Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
-
string $fileComment optional NULL
(Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
addStreamData
topAdd data to the open stream.
- Parameters:
-
-
String $data required
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
$length bytes added or false if the archive is finalized or there are no open stream.
buildZipEntry
topBuild the Zip file structures
- Parameters:
-
-
String $filePath required
-
String $fileComment required
-
String $gpFlags required
-
String $gzType required
-
int $timestamp required
-
string $fileCRC32 required
-
int $gzLength required
-
int $dataLength required
-
integer $extFileAttr required
16 for directories, 32 for files.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
closeStream
top__construct
topConstructor.
- Parameters:
-
-
$archiveName optional ''
-
String $contentType optional 'application/zip'
Content mime type. Optional, defailts to "application/zip".
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
finalize
topClose the archive. A closed archive can no longer have new files added to it.
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
getDosTime
topCalculate the 2 byte dostime used in the zip entries.
- Parameters:
-
-
int $timestamp optional 0
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
2-byte encoded DOS Date
getRelativePath
topClean up a path, removing any unnecessary elements such as /./, // or redundant ../ segments. If the path starts with a "/", it is deemed an absolute path and any /../ in the beginning is stripped off. The returned path will not end in a "/".
- Parameters:
-
-
$path required
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
String the clean path
openStream
topCreate a stream to be used for large entries.
- Parameters:
-
-
string $filePath required
Filepath and name to be used in the archive.
-
int $timestamp optional 0
(Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used.
-
string $fileComment optional NULL
(Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
pathJoin
topJoin $file to $dir path, and clean up any excess slashes.
- Parameters:
-
-
String $dir required
-
String $file required
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
setComment
topSet Zip archive comment.
- Parameters:
-
-
string $newComment optional NULL
New comment. null to clear.
-
- Method defined in:
- Vendor/ZipStream/ZipStream.php
- Return
bool $success
