/ 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:

Show/Hide parent properties
  • cdRec

  • centralFileHeader

  • endOfCentralDirectory

  • isFinalized

  • localFileHeader

  • offset

  • streamChunkSize

  • streamComment

  • streamData

  • streamFile

  • streamFileLength

  • streamFilePath

  • streamTimeStamp

  • zipComment

  • zipMemoryThreshold

addDirectory

top

Add 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

top

Add 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

top

Add 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

top

Add 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

top

Add 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

top

Build 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

Close the current stream.

Method defined in:
Vendor/ZipStream/ZipStream.php
Return

bool $success

__construct

top

Constructor.

Parameters:
  • $archiveName optional ''

  • String $contentType optional 'application/zip'

    Content mime type. Optional, defailts to "application/zip".

Method defined in:
Vendor/ZipStream/ZipStream.php

__destruct

top

Method defined in:
Vendor/ZipStream/ZipStream.php

finalize

top

Close 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

top

Calculate 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

top

Clean 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

top

Create 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

top

Join $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

top

Set Zip archive comment.

Parameters:
  • string $newComment optional NULL

    New comment. null to clear.

Method defined in:
Vendor/ZipStream/ZipStream.php
Return

bool $success